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:
def main():
    l, r = map(int, input().split())
    
    a = l % 2019
    b = r % 2019
    if a >= b or r - l + 1 > 2018 or l % 2019 == 0 or r % 2019 == 0:
        print(0)
    else:
        c = []
        for i in range(l, r+1):
            c.append(i % 2019)
        if 3 in c and 673 in c:
            print(0)
        else:
            print(c[0] * c[1])
        
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    
    a = l % 2019
    b = r % 2019
    if a >= b or r - l > 2018 or l % 2019 == 0 or r % 2019 == 0:
        print(0)
    else:
        c = []
        for i in range(l, r+1):
            c.append(i % 2019)
        if 3 in c and 673 in c:
            print(0)
        else:
            print(c[0] * c[1])
        
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    
    a = l % 2019
    b = r % 2019
    if a >= b or r - l > 2019 or l % 2019 == 0 or r % 2019 == 0:
        print(0)
    else:
        print(0)
        
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    
    a = l % 2019
    b = r % 2019
    if a >= b or r - l > 2019 or l % 2019 == 0 or r % 2019 == 0:
        print(0)
    else:
        c = []
        for i in range(l, r+1):
            c.append(i % 2019)
        if 3 in c and 673 in c:
            print(0)
        else:
            print(c[0] * c[1])
        
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

l %= 2019
r %= 2019

mina = float('INF')

for x in range(l,r+1):
    for y in range(x,r+1):
        if(x==y):
            continue
        ans = (x * y) % 2019
        if(mina > ans):
            mina = ans
        
print(mina)

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    
    a = l % 2019
    b = r % 2019
    if a >= b or r - l >= 2019:
        print(0)
    else:
        c = []
        for i in range(l, r+1):
            c.append(i % 2019)
        if 3 in c and 673 in c:
            print(0)
        else:
            print(c[0] * c[1])
        
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    
    m1 = 10 **10
    m2 = 10 **10
    index1 = 0
    index2 = 0
    
    for i in range(l, r + 1):
        if m1 > i % 2019:
            m1 = i % 2019
            index1 = i
    for i in range(l, r + 1):
        if m2 > i % 2019 and index1 != i:
            m2 = i % 2019
            index2 = i
            
    print((index1 * index2) % 2019)
    
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mini = 9999
if R - L >2019:
  R = L + 2019
for l in range(L, R + 1):
  for r in range(l + 1, R + 1):
    temp = (r * l) % 2019
    if temp == 0:
      break
    if temp < mini:
      mini = temp
print(mini)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
ls = L // 2019
la = L % 2019
rs = R // 2019
ra = R % 2019
ans = 0
if ls == rs:
    ans = la * (la + 1)
elif rs - ls == 1:
    if ra == 0:
        ans = la
    else:
        ans = 0
else:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
ls = L // 2019
la = L % 2019
rs = R // 2019
ra = R % 2019
ans = 0
if ls == rs:
    ans = la * (la + 1)
elif rs - ls == 1:
    if ra == 0:
        ans = la
    else:
        ans = 1
else:
    ans = 1
print(ans)

Submission status: Wrong Answer

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

L = 1
R = 2018

ind_s = L
ind_e = min(L + 2019, R)

choices_mod = [x%2019 for x in range(ind_s, ind_e+1)]
# choices_mod_sort = sorted(choices_mod)

if len(choices_mod) == 1:
    print(choices_mod[0])
elif 0 in choices_mod:
    print(0)
else:
    import itertools
    pairs = list(itertools.combinations(choices_mod, 2))
    
    ans_list = []
    for a, b in pairs:
        ans_list.append((a*b)%2019)
        
    print(min(ans_list))

Submission status: Wrong Answer

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

ind_s = L
ind_e = min(L + 2019, R)

choices_mod = [x%2019 for x in range(ind_s, ind_e+1)]
choices_mod_sort = sorted(choices_mod)

if len(choices_mod_sort) >= 2:
    print((choices_mod_sort[0]*choices_mod_sort[1])%2019)
else:
    print(choices_mod_sort[0])

Submission status: Wrong Answer

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

ind_s = L
ind_e = min(L + 2019, R)

choices_mod = [x%2019 for x in range(ind_s, ind_e+1)]
choices_mod_sort = sorted(choices_mod)

if len(choices_mod_sort) >= 2:
    print(choices_mod_sort[0]*choices_mod_sort[1])
else:
    print(choices_mod_sort[0])

Submission status: Wrong Answer

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

if r - l >= 2019:
    print(0)
    exit()

for i in range(l,r+1):
    for j in range(i,r+1):

        mod = min(mod,(i*j)%2019)
        if mod == 0:
            break

print(mod)

Submission status: Wrong Answer

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

if r - l >= 2019:
    print(0)
    exit()

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

        mod = min(mod,(i*j)%2019)
        if mod == 0:
            break

print(mod)

Submission status: Wrong Answer

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

if r - l >= 2019:
    print(0)
    exit()
    
l %= 2019
r %= 2019
for i in range(l,r):
    for j in range(i,r):

        mod = min(mod,(i*j)%2019)
        if mod == 0:
            break

print(mod)

Submission status: Wrong Answer

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

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

print(mod)

Submission status: Wrong Answer

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

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

print(mod)

Submission status: Wrong Answer

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

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

print(mod)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
mod = 2020
for i in range(l,r+1):
    mod = min(mod,i%2019)
    if mod == 0:
        break

print(mod*(mod+1))

Submission status: Wrong Answer

Solution code:
import sys

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

if 2018 < r - l + 1:
    print(0)
    sys.exit()

remainder = []
for i in range(l, r + 1):
    remainder.append(i % 2019)

remainder.sort()

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

Submission status: Wrong Answer

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

dic = {}
for i in range(l, r + 1):
    remainder = i % 2019
    if remainder in dic.keys():
        break
    else:
        dic[remainder] = 1

l = list(dic.keys())
l.sort()

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

Submission status: Wrong Answer

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

dic = {}
for i in range(l, r + 1):
    remainder = i % 2019
    if remainder in dic.keys():
        break
    else:
        dic[remainder] = 1

l = list(dic.keys())
l.sort()

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
if (l <= 2019 and r >= 2019) or (l <= 2019**2 and r >= 2019**2) or (l <= 2019**3 and r >= 2019**3):
    print(0)
    exit()
    
print((l%2019) * ((l+1)%2019))

Submission status: Wrong Answer

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

if L//2019 == R//2019:
  num = float("inf")
  for i in range(L%2019, R%2019):
    for j in range(i+1, R%2019+1):
      if num >= (i*j)%2019:
        num = (i*j)%2019
  print(num)
else:
  num = float("inf")
  for i in range(L%2019, 2018):
    for j in range(i+1, 2019):
      if num >= (i*j)%2019:
        num = (i*j)%2019
  print(num)

Submission status: Wrong Answer

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

if L//2019 == R//2019:
  num = float("inf")
  for i in range(L%2019, R%2019):
    for j in range(i+1, R%2019+1):
      if num >= (i*j)%2019:
        num = (i*j)%2019
  print(num)
else:
  num = float("inf")
  for i in range(L%2019, 2017):
    for j in range(i+1, 2018):
      if num >= (i*j)%2019:
        num = (i*j)%2019
  print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L_resi = L % 2019
R_resi = R % 2019

residue = []

if L - R >= 2018:
    # residue = [i for i in range(0, 2019)]
    ans = 0
else:
    if L_resi < R_resi:
        residue = [i for i in range(L_resi, R_resi+1)]
    else:
        residue = [i for i in range(0, R_resi+1)] + [i for i in range(L_resi, 2019)]

    ans = 10**100
    for i in residue:
        for j in residue:
            if i < j:
                ans = min(ans, (i*j) % 2019)
print(ans)

Submission status: Wrong Answer

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

L_resi = L % 2019
R_resi = R % 2019

residue = []

if L - R >= 2018:
    residue = [i for i in range(0, 2019)]
else:
    if L_resi < R_resi:
        residue = [i for i in range(L_resi, R_resi+1)]
    else:
        residue = [i for i in range(0, R_resi+1)] + [i for i in range(L_resi, 2019)]

ans = 10**100
for i in residue:
    for j in residue:
        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 == 0 or (l-1)//2019 != r//2019 or ((l-1)//3 != r//3 and (l-1)//673 != r//673):
	print(0)
else:
	print((((l%2019)*((l+1)%2019))%2019)%2019)

Submission status: Wrong Answer

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

if l == 0 or (l-1)//2019 != r//2019:
	print(0)
else:
	print((((l%2019)*((l+1)%2019))%2019)%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))%2019)%2019)

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 l//2019 != r//2019:
	print(0)
else:
	print(((l%2019)*((l+1)%2019))%2019)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
l,r = map(int,input().split())
c = 10**9
if r - l >= 2019:
    print(0)
    sys.exit()
for i in range(l,r):
    for j in range(i+1,r+1):
        print(i,j)
        x = (i * j) % 2019
        print(x)
        if x < c:
            c = x
    
print(c)

Submission status: Wrong Answer

Solution code:
import sys
l,r = map(int,input().split())
c = 10**9
if r - l >= 2018:
    print(0)
    sys.exit()
for i in range(l,r):
    for j in range(i+1,r+1):
        print(i,j)
        x = (i * j) % 2019
        print(x)
        if x < c:
            c = x
    
print(c)

Submission status: Wrong Answer

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

R = min(R, L+4038)

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

Submission status: Wrong Answer

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

R = min(R, L+2019)

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

Submission status: Wrong Answer

Solution code:
import itertools

l, r = map(int, input().split())
l_rest = l % 2019
r_rest = r % 2019

if l_rest == 0 or r_rest == 0:
    print(0)
else:
    lr_list = list(range(l_rest, r_rest+1))
    lr_comb = list(itertools.combinations(lr_list, 2))
    min_rest = 2019
    for comb in lr_comb:
        rest = comb[0] * comb[1]
        min_rest = min(min_rest, rest%2019)
    print(min_rest)

Submission status: Wrong Answer

Solution code:
# 2019の倍数がlとrの間に含まれているかどうかを考える
l, r = map(int, input().split())

if r < 2019:
    print(l*(l+1)%2019)
elif l%2019 == 0 or r%2019 == 0:
    print(0)
elif r >= 2019 and r%2019 > (l-r):
    print(l*(l+1)%2019)
elif r >= 2019 and r%2019 < (l-r):
    print(0)

Submission status: Wrong Answer

Solution code:
def main():
    L, R = map(int, input().split())
    check_point = 2019
    num_2019 = 0
    while check_point <= R:
        if check_point >= L:
            num_2019 += 1
        check_point += 2019

    if num_2019 >= 1:
        print(0)
    else:
        print(L*(L+1) % 2019)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    L, R = map(int, input().split())
    modmin = 2018
    tmp = L
    while tmp <= R:
        if tmp % 2019 == 0:
            modmin = 1
            break
        modmin = min((tmp*(tmp+1)) % 2019, modmin)
        tmp += 1

    print(modmin)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
p = a%2019
for i in range (a,b+1) :
    p = min(p,i%2019)
    if i%673 == 0 and b-a > 2 :
        print(0)
        exit(0)
    elif i%2019 == 0 :
        print(0)
        exit(0)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
cnt = 0
while 2019 * cnt <= R:
    if L <= 2019 * cnt:
        print(0)
        break

    cnt += 1
print(min(L * (L + 1) % 2019, (R - 1) * R % 2019))

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
cnt = 0
while 2019 * cnt <= R:
    if L <= 2019 * cnt:
        print(0)
        break

    cnt += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = (R - L)%2019
L %= 2019
R = L + x

#print(L,R)

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

if L == 0 or R == 0:
  m = 0

print(m)

Submission status: Wrong Answer

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

x = (R - L)%2019
L %= 2019
R = L + x

print(L,R)

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

if L == 0 or R == 0:
  m = 0

print(m)

Submission status: Wrong Answer

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

x = (R - L)%2019
L %= 2019
R = L + x

#print(L,R)

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

Submission status: Wrong Answer

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

x = (R - L)%2019
L %= 2019
R = L + x

print(L,R)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


if L == 0 or R-L >= 2019:
    ans = 0
else:
    flag = True
    for i in range(L, R+1):
        if i % 2019 == 0:
            ans = 0
            flag = False
            break
    if flag:
        ans = (L*(L+1))%2019

print(ans)

Submission status: Wrong Answer

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

mod_L = L % 2019
mod_R = R % 2019

if mod_L < mod_R:
    print(L*(L+1)%2019)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

L, R = map(int, input().split())
mod = 2019
min_score = float('inf')
L = L%mod
R = R%mod    
if L<R:
    pair = [i for i in range(L,R+1)]
else:
    pair = [i for i in range(L,mod)]
    for i in range(R+1):
        pair.append(i)
for a,b in combinations(pair,2):
    min_score = min(min_score, a*b%mod)
print(min_score)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

L, R = map(int, input().split())
mod = 2019
min_score = float('inf')
L = L%mod
R = R%mod    
if L<R:
    pair = [i for i in range(L,R+1)]
else:
    pair = [i for i in range(L,mod)]
    for i in range(R+1):
        pair.append(i)
for a,b in combinations(pair,2):
    min(min_score, a*b%mod)
print(min_score)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

L, R = map(int, input().split())
mod = 2019
min_score = float('inf')
L = L%mod
R = R%mod    
if L<R:
    pair = [i for i in range(L,R+1)]
else:
    pair = [i for i in range(L,mod)]
    for i in range(R+1):
        pair.append(i)
for a,b in combinations(pair,2):
    score = a*b%mod
    if score < min_score:
        min_score = score
print(min_score)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# define
nums = R - L + 1
mod = 2019

# main
if nums > 2019:
  nums = 2019
else:
  nums = R
  
ans = float('inf')
for i in range(L, nums+1):
  for j in range(i+1, nums+1):
    tmp = (i % mod) * (j % mod)
    if tmp < ans:
      ans = tmp

# output
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = (int(a) for a in input().split())
ans = []
for i in range(L,R+1) :
    ans.append(i%2019) 

Ans = sorted(ans)
print(Ans[0]*Ans[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = list(map(int,input().split()))
if R-L >= 3000:
    print(2)
    exit()
MIN = float('inf')
for i in range(L,R+1):
    for j in range(L,R+1):
        if i == j: continue
        MIN = min(MIN,(i*j)%2019)
print(MIN)

Submission status: Wrong Answer

Solution code:
L,R = list(map(int,input().split()))
if R-L >= 2019:
    print(2)
    exit()
MIN = float('inf')
for i in range(L,R+1):
    for j in range(L,R+1):
        if i == j: continue
        MIN = min(MIN,(i*j)%2019)
print(MIN)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L,R = map(int,input().split())
lst = []

if L <= 2019 and R >= 2019:
    print(0)
else:
    for i in range(L,R+1):
        if i % 2019 == 0:
            print(0)
            break
        for j in range(i+1,R+1):
            if j % 2019 == 0:
                print(0)
                break
            lst.append((i * j) % 2019)
        else:
            continue
        break
        print(min(lst))

Submission status: Wrong Answer

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

L,R = map(int,input().split())
lst = []

if L <= 2019 and R >= 2019:
    print(0)
else:
    for i in range(L,R+1):
        if i % 2019 == 0:
            print(0)
            break
        for j in range(i+1,R+1):
            if j % 2019 == 0:
                print(0)
                break
            lst.append((i * j) % 2019)
        else:
            continue
        break
    print(min(lst))

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    l,r = map(int, input().split())
    num = 2019
    ans_num = 2019
    if  (2019 <= r-l):
        ans_num = 0
    for i in range(l+1,l+2020):
        if r < i:
            break
        else:
            ans = (l*i)%num
            if ans < ans_num:
                ans_num = ans
    print(ans_num)
   
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    l,r = map(int, input().split())
    num = 2019
    ans_num = 2019
    if (r-l <= 2019):
        ans_num = 0
    for i in range(l+1,l+2020):
        if r < i:
            break
        else:
            ans = (l*i)%num
            if ans < ans_num:
                ans_num = ans
    print(ans_num)
   
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

mod = 2019
ans = 0
if l % mod == 0 or r % mod == 0:
    ans = 0
elif l >= mod:
    ans = 2
else:
    ans = l*l + l

print(ans)

Submission status: Wrong Answer

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    l,r = map(int, input().split())
    num = 2019
    ans_num = 2019
    for i in range(l+1,l+2020):
        if r < i:
            break
        else:
            ans = (l*i)%num
            if ans < ans_num:
                ans_num = ans
    print(ans_num)
   
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    l,r = map(int, input().split())
    num = 2019
    ans_num = 2019
    for i in range(l,r+1):
        for j in range(r,l,-1):
            ans = (i*j)%2019
            if ans == 0:
                ans_num = 0
            else:
                if ans < ans_num:
                    ans_num = ans
    print(ans_num)
   
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
l, r = map(int, input().split())
a = 2019
for i in range(l, r + 1):
    for j in range(i+1, r + 1):
        if i % 2019 == 0 or j % 2019 == 0:
            print(0)
            break
        else:
            a = min(a, (i%2019)*(j%2019)%2019)
    else:
        continue
    break
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def mod2019(x):
    return (x%2019 * (x+1)%2019 ) % 2019

L,R = list(map(int, input().split()))
ans=2019
s=set()
for i in range(L,R):
    if i%2019 in s:
        break
    s.add(i%2019)
    mod = mod2019(i)
    ans = min(ans, mod2019(i))

print(ans)

Submission status: Wrong Answer

Solution code:
def mod2019(x):
    return (x%2019 * (x+1)%2019 ) % 2019

L,R = list(map(int, input().split()))
ans=2019
s=set()
for i in range(L,R+1):
    if i in s:
        break
    mod = mod2019(i)
    s.add(i)
    ans = min(ans, mod2019(i))

print(ans)

Submission status: Wrong Answer

Solution code:
def mod2019(x):
    return x%2019

L,R = list(map(int, input().split()))
a=list(set([mod2019(i) for i in range(L,R+1)]))
ans=2019
for i in range(len(a)-1):
    ans = min(ans, mod2019(a[i]*a[i+1]))
print(ans)

Submission status: Wrong Answer

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

ans = 2018
if R - L >= 2019:
  print(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:
l,r = [int(x) for x in input().split()]

mod = 2019
b = False
ans = 2020
for i in range(l, r):
    for j in range(i+1, r+1):
        if i*j%mod == 0 and b:
            break
        elif i*j%mod == 0:
            b = True
        else:
            ans = min(ans, i*j%mod)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def solve(l,r):
    num = float("inf")
    count = 0
    for i in range(l,r):
        for j in range(i+1,r+1):
            if count >= 2019**2:
                print(num)
                return
            
            current = (i*j) % 2019
            if current == 0:
                print(num)
                return
            
            num = min(current,num)
            count += 1
    
    print(num)

solve(l,r)

Submission status: Wrong Answer

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

def solve(l,r):
    num = float("inf")
    for i in range(l, r):
        current = (i*(i+1)) % 2019
        num = min(num,current)
        if num == 0:
            print(num)
            return
    
    print(num)

solve(l,r)