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())

ans = 3000

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

print(ans)

Submission status: Wrong Answer

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

ans = 2019
for i in range(L,R):
    if (i*(i+1))%2019 <= ans :
        ans = (i*(i+1))%2019
        if ans == 0 :
            break

print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if l == 0:
  print(0)
  exit()
dv = l // 2019
l -= (dv * 2019)
r -= (dv * 2019)
if r - l >= 2022:
  dv = (r - l) // 2019
  r -= (dv * 2019)
res = 2018
for i in range(l, r):
  for j in range(i + 1, r + 1):
    res = min(res, ((i * j) % 2019))
print(res)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
dv = l // 2019
l -= (dv * 2019)
r -= (dv * 2019)
if r - l >= 2022:
  dv = (r - l) // 2019
  r -= (dv * 2019)
res = 2018
for i in range(l, r):
  for j in range(i + 1, r + 1):
    res = min(res, ((i * j) % 2019))
print(res)

Submission status: Wrong Answer

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

# 前提として、LとRの差が2019より小さいとき

# modを比較し、LよりRの方が大きい時は2019の倍数を通り越していない
# modを比較し、LよりRの方が小さい時は2019の倍数を通り越している

deff = R - L
if (deff < 2019):
    Lamari = L % 2019
    Ramari = R % 2019
    if (Lamari < Ramari):
        if (Lamari * (Lamari + 1) > 2019):
            print((Lamari * (Lamari + 1)) % 2019)
        else:
            print(Lamari * (Lamari + 1))
    else:
        print(0)
else:
    print(0)

Submission status: Wrong Answer

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

ans = float('inf')
for i in range(1, 2020 ** 2 + 1):
    if l <= i and i + 1 <= r:
        ans = min(ans, i * (i + 1) % 2019)

print(ans)

Submission status: Wrong Answer

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

# 前提として、LとRの差が2019より小さいとき

# modを比較し、LよりRの方が大きい時は2019の倍数を通り越していない
# modを比較し、LよりRの方が小さい時は2019の倍数を通り越している

deff = R - L
if (deff < 2019):
    Lamari = L % 2019
    Ramari = R % 2019
    if (Lamari < Ramari):
        print(Lamari * (Lamari + 1))
    else:
        print(0)
else:
    print(0)

Submission status: Wrong Answer

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

# 前提として、LとRの差が2019より小さいとき

# modを比較し、LよりRの方が大きい時は2019の倍数を通り越していない
# modを比較し、LよりRの方が小さい時は2019の倍数を通り越している

deff = R - L + 1
if (deff < 2019):
    Lamari = L % 2019
    Ramari = R % 2019
    if (Lamari < Ramari):
        print(Lamari * (Lamari + 1))
        exit()
    else:
        print(0)
        exit()
else:
    print(0)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

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

min_num.sort()
print(min_num[0] * min_num[1])

Submission status: Wrong Answer

Solution code:
import sys
l,r = map(int,input().split())
l=l%2019
r=r%2019
if l>=r or l+2019 <= r:
  print(0)
  sys.exit()

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans=2018
for i in range(l,r):
  if ans == 0:
    break
  for j in range(i+1,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())

if L % 2019 == 0 or R % 2019 == 0:
    print(0)
    exit()

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

for i in range(L+1, R):
    if i % 2019 == 0:
        print(0)
        exit()

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if r%2019<=l%2019 or r-l>=2019: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:print(l*(l+1)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
l=L%2019
r=R%2019
#print(l,r)
if l<r and L//2019 == R//2019:
    print(l*(l+1))
elif l<r and L//2019<R/2019:
    print(0)
elif l==r:
    print(0)
elif l>r:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
import sys
mod=2019
ans=float('inf')

for i in range(l,r+1):
  for j in range(i+1,r+1):
    ans=min(((i%mod)*(j%mod)),ans)
    if ans==0:
      print(0)
      sys.exit()
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
import sys
mod=2019
ans=float('inf')

for i in range(l,r+1):
  for j in range(l,r+1):
    if i<j:
      ans=min((i%mod)*(j%mod),ans)
      if ans==0:
        print(0)
        sys.exit()
print(ans)

Submission status: Wrong Answer

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

mod=2019
sa=r-l
ans=float('inf')
if 2019<=sa:
  print(0)
else:
  for i in range(l,r+1):
    for j in range(l,r+1):
      if i<j:
        ans=min((i%mod)*(j%mod),ans)
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ans=l*r
if l//2019!=r//2019:
    ans=0
elif l%2019==0 or r%2019==0:
    ans=0
else:
    num1=l%2019
    num2=r%2019
    for i in range(num1,num2):
        for j in range(i+1,num2+1):
            num=(i*j)%2019
            if ans>num:
                ans=num
        if ans==1:
            break
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
l_mod=l%2019
r_mod=r%2019
l_div=l//2019
r_div=r//2019
if l_div<r_div:
  print(0)
else:
  print(l_mod*(l_mod+1))
#余り同士の掛け算で２０１９を超えた場合modが小さくなることをかんがえていないためwa

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
url = "https://atcoder.jp//contests/abc133/tasks/abc133_c"

def main():
    t = list(map(int, input().split()))
    ans = []
    for i in range(t[0], t[1]+1):
        for j in range(i+1, t[1]+1):
            val = (i*j) % 2019
            if val == 0:
                print(val)
                break
            ans.append(val)
    print(min(ans))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = float('inf')
for i in range(l, r):
    for j in range(i + 1, r + 1):
        x = i * j % 2019
        if x == 0:
            break
        ans = min(ans, x)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    if R - L > 3000:
        print(0)
    else:
        A = [i % 2019 for i in range(L, R + 1)]
        ans = INF
        for i in range(R - L):
            for j in range(i + 1, R - L + 1):
                ans = min(ans, A[i] * A[j] % MOD)
        print(ans)

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    if False:
        print(0)
    else:
        A = [i % 2019 for i in range(L, R + 1)]
        A.sort()
        print(A[0] * A[1])

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    low = 0
    mid = 0

    for i in range(int(math.ceil(R / 2019)) + 1):
        if  L <= i * 2019 <= R:
            mid = i * 2019
        
        if i * 2019 <= L:
            low = i*2019

    for i in range(2030):
        if low + i == L:
            low += i
            break
    
    if mid != 0:
        print(0)
    else:
        print((low * (low + 1)) % 2019)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    for i in range(L//2019 + 2):
        if  L <= i * 2019 <= R:
            mid = i * 2019
            break
        
    if mid != 0:
        print(0)

    else:
        low = 0
        for i in range(L//2019 + 1):
            if i*2019 <= L:
                low = i*2019
            else:
                break

        for i in range(2020):
            if low + i == L:
                low += i
                break

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    for i in range(L//2019 + 1):
        if i*2019 <= L:
            low = i*2019
        else:
            break

    for i in range(2020):
        if low + i == L:
            low += i
            break

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if b-a>=2019:
    print(0)
    exit()

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())

mod = 2019

lm = l % mod
rm = r % mod

ans = []
if r - l >= mod :
  print(0)
  exit()
else:
  for i in range(lm,rm):
    for j in range(i+1,rm+1):
      ans.append(i*j)
  print(min(ans))

Submission status: Wrong Answer

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

l = l%2019
r = r%2019

if l >= r:
    print(0)
else:
    ans = float('inf')
    for left in range(l, r):
        for right in range(left+1, r+1):
            ans = min(ans, (left*right)%2019)
    print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ans = float("inf")

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

Submission status: Wrong Answer

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

ans =[]
for i in range(L,R+1):
    for j in range(i+1,R+1):
        ans.append(i*j%2019)
        if i*j% 2019== 0 :
            exit()

print(min(ans))

Submission status: Wrong Answer

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

cnt = 0
i = L
j = L+1
min_num = 2020
while i <= R and cnt <= 2019:
    j = i+1
    while j <= R and cnt <= 2019:
        min_num = min(min_num,(i*j)%2019)
        j += 1
        cnt += 1
    i += 1
print(min_num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans = float('inf')
for i in range(l, r):
  t = i*(i+1)%2019
  ans = min(ans,t)
print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)

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

MOD = 2019

n = 2019

pf = {}

for i in range(2,int(n**0.5)+1):
    while n % i == 0:
        pf[i] = pf.get(i,0) + 1
        n //= i
if n > 1: pf[n] = 1

# 2019=3*673

l_mod = l%MOD
r_mod = r%MOD

if r-l > 2019:
    ans = 0
else:
    if l_mod <= 3 <= r_mod and l_mod <= 673 <= r_mod:
        ans = 0
    elif l_mod < r_mod:
        ans = l_mod*(l_mod+1)%MOD
    else:
        ans = 0

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
l, r = map(int, input().split())
#s = input()
#s,t = input().split()
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

MOD = 2019

l_mod = l%MOD
r_mod = r%MOD

if r-l > 2019:
    ans = 0
else:
    if l_mod < r_mod:
        ans = l_mod*(l_mod+1)%MOD
    else:
        ans = 0

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
l,r=map(int,input().split())
if l+2019<=r:
  print(0)
  sys.exit()
mn=2018
for i in range(l,r):
  mn=min(mn,i%2019)
if r%2019:
  print(mn*(mn+1))
else:print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
l = L//2019
r = R//2019
m = L%2019
n = R%2019

ans = 2018
if l != r:
  print(0)
else:
  for i in range(m,n):
    for j in range(i+1,n+1):
      ans = min((i*j) % 2019, ans)
      
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
l = L//2019
r = R//2019
m = L%2019
n = R%2019

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

Submission status: Wrong Answer

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

N = 2019

q = L // N
L_min = L % N
R_min = min(2019, R % N)


ans = 2019

for i in range(L_min, R_min):
    for j in range(i + 1, R_min + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod

print(ans)

Submission status: Wrong Answer

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

N = 2019

if R - L == 1:
    print((R * L) % N)
    exit(0)

q = L // N
L_min = L % N
R_min = min(2019, R % N)


ans = 2019

for i in range(L_min, R_min):
    for j in range(i + 1, R_min + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod

print(ans)

Submission status: Wrong Answer

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

N = 2019

if R - L == 1:
    print((R * L) % N)
    exit(0)

q = L // N
L_min = L % N
R_min = R % N

if L_min > R_min:
    L_min, R_min = R_min, L_min

ans = 2019

for i in range(L_min, R_min):
    for j in range(i + 1, R_min + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod

print(ans)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    l = l % 2019
    r = r % 2019
    minv =2019
    for i in range(l, r+1):
        for j in range(l, r+1):
            if i < j:
                minv = min(minv, i*j%2019)
    print(minv)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

l %= 2019
r %= 2019

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

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

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

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 %= 2019
r %= 2019

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

ans = 2018

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 %= 2019
r %= 2019

ans = 2018

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())

lmod2019=l%2019
rmod2019=r%2019

if lmod2019==0 or lmod2019>=rmod2019:
    print(0)
else:
    min=10**8
    for i in range(r-l):
        for j in range(r-l):
            k=(i+lmod2019)*(j+lmod2019)
            if k<min:
                min=k
    print(min)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lmod673=l%673
rmod673=r%673
lmod2019=l%2019
rmod2019=r%2019

if lmod2019==0 or lmod2019>=rmod2019:
    print(0)
elif rmod2019-lmod2019>=672:
    print(0)
elif lmod673>rmod673 or lmod673==0:
    if r-l>=2:
        print(0)
    elif (lmod2019*rmod2019)%3==0:
        print(0)
    else:
        print(lmod2019*(lmod2019+1))
else:
    print(lmod2019*(lmod2019+1))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lmod673=l%673
rmod673=r%673
lmod2019=l%2019
rmod2019=r%2019

if lmod2019==0 or lmod2019>rmod2019:
    print(0)
elif rmod2019-lmod2019>=672:
    print(0)
elif lmod673>rmod673 or lmod673==0:
    if r-l>=2:
        print(0)
    elif (lmod2019*rmod2019)%3==0:
        print(0)
    else:
        print(lmod2019*(lmod2019+1))
else:
    print(lmod2019*(lmod2019+1))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lmod673=l%673
rmod673=r%673
lmod2019=l%2019
rmod2019=r%2019

if lmod2019==0 or lmod2019>rmod2019:
    print(0)
elif rmod2019-lmod2019>=673:
    print(0)
elif lmod673>rmod673 or lmod673==0:
    if r-l>=2:
        print(0)
    elif (lmod2019*rmod2019)%3==0:
        print(0)
    else:
        print(lmod2019*(lmod2019+1))
else:
    print(lmod2019*(lmod2019+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
m=[2018,2018]
while L!=R and L<R:
    m=sorted([L%2019,R%2019]+m)[:2]
    L+=1
    R-=1
print(m[0]*m[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l = L%2019
r = R%2019
res = 2018
for i in range(l, r+1):
  for j in range(i+1,r+1):
    if (i*j)%2019==  0:
      print(0)
      exit()

    res = min(res, i*j)

print(res)

Submission status: Wrong Answer

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

l = L%2019
r = R%2019
res = 2018
for i in range(l, r+1):
  for j in range(i+1,r+1):
    if i*j == 0:
      print(0)
      exit()

    res = min(res, i*j)

print(res)

Submission status: Wrong Answer

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

l = L%2019
r = R%2019
res = 2018
for i in range(l):
  for j in range(i+1,r):
    if i*j == 0:
      print(0)
      exit()

    rem = min(res, i*j)

print(res)

Submission status: Wrong Answer

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

l = L%2019
r = R%2019

if l < r:
  if l <= 3 and r >= 673:
    print(0)
  else:
    print((L*(L+1)%2019))
else:
  print(0)

Submission status: Wrong Answer

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

l = L%2019
r = R%2019
if l < r:
  print(l*(L+1)%2019)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    l, r = map(int, input().split())
    if l % 2019 == 0 or r % 2019 == 0:
        ans = 0
    else:
        i = min(sorted(divisor(l)))
        j = min(sorted(divisor(r)))
        ans = (i+1) * (j)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    l, r = map(int, input().split())
    print(l, r)
    if l % 2019 == 0 or r % 2019 == 0:
        ans = 0
    else:
        i = min(sorted(divisor(l)))
        j = min(sorted(divisor(r)))
        ans = (i+1) * (j)
    print(ans)


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