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():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number_list = (lambda: list(map(int, input_list())))

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number_list = (lambda: list(map(int, input_list())))

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

tmp=10**9+1
ans=10**0+1

for i in range(L,R+1):
  for j in range(L,R+1):
    if i<j:
      tmp=(i*j)%2019
      if ans==0:
          print(0)
          sys.exit()
      elif tmp<ans:
          ans=tmp
print(ans)

Submission status: Wrong Answer

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

tmp=10**9+1
ans=10**0+1

for i in range(L,R+1):
  for j in range(L,R+1):
    if i<=j:
      tmp=(i*j)%2019
      if ans==0:
          print(0)
          sys.exit()
      elif tmp<ans:
          ans=tmp
print(ans)

Submission status: Wrong Answer

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

ans=10**9+1


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

Submission status: Wrong Answer

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

ans=10**9+1


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

print(ans)

Submission status: Wrong Answer

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

ans=10**9+1


for i in range(2020):
  for j in range(2020):
    if i<j:
      ans=min((i*j)%2019,ans)

print(ans)

Submission status: Wrong Answer

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

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

    if i<j:
      ans=min((i*j)%2019,ans)
print(ans)

Submission status: Wrong Answer

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

MOD = 2019  # type: int


def solve(L: int, R: int):
    if L // 2019 == R // 2019:
        a = L % 2019
        max = R % 2019
        ans = 2019
        for j in range(a + 1, max + 1):
            com = (a * j) % 2019
            ans = min(ans, com)
        print(ans)
    else:
        print(0)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

MOD = 2019  # type: int


def solve(L: int, R: int):
    if L // 2019 == R // 2019:
        a = L % 2019
        print((a * (a + 1)) % 2019)
    else:
        print(0)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

MOD = 2019  # type: int


def solve(L: int, R: int):
    if L // 2019 == R // 2019:
        a = L % 2019
        print(a * (a + 1))
    else:
        print(0)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

MOD = 2019  # type: int


def solve(L: int, R: int):
    LmM = L % MOD
    minimum = L - LmM + MOD
    if minimum < R:
        print(str(0))
    else:
        print(LmM*(LmM+1))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
import collections
from operator import mul
from functools import reduce

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


L%=2019
R%=2019

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


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

Submission status: Wrong Answer

Solution code:
import math
import collections
from operator import mul
from functools import reduce

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


L%=2019
R%=2019
if L>R:
    R+=2019
else:
    print(0)
    exit()

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

Submission status: Wrong Answer

Solution code:
import math
import collections
from operator import mul
from functools import reduce

L,R=map(int,input().split())
L%=2019
R%=2019
if L>=R:
    R+=2019

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

Submission status: Wrong Answer

Solution code:
import math
import collections
from operator import mul
from functools import reduce

L,R=map(int,input().split())
L%=2019
R%=2019
if L>R:
    R+=2019

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
A = [None]*2019
for i in range(L,R+1):
  if A[i%2019] is not None:
    break
  else:
    A[i%2019] = i%2019
A = sorted(list(filter(lambda x: x is not None,A)))
print(A[0]*A[1])

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
A = [None]*2019
for i in range(L,R+1):
  if A[i%2019] is not None:
    break
  else:
    A[i%2019] = i%2019
A = list(filter(lambda x: x is not None,A))
print(A[0]*A[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

A = []

for i in range(a, min(a+4000, b+1)):
    A.append(i%2019)

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

if (b - a + 1) >= 673:
    print(0)
else:
    print(A[0] * A[1])

Submission status: Wrong Answer

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

if (L <= 3 and R >= 3) or (L <= 673 and R >= 673):
    ans = 0
elif R - L >= 2019:
    ans = 1
else:
    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())
mod = 2019
min = 10**9
c = 0
for i in range(l,r):
    j = i+1
    if (i*j)%mod < min:
        min = (i*j)%mod
    
    if min == 0:
        break
print(min)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
mod = 2019
min_2019 = min(2019,r-l)
min = 10**9
c = 0
for i in range(l,r):
    c += 1
    if c == 2020:
        break
    j = i+1
    if (i*j)%mod < min:
        min = (i*j)%mod
    
    if min == 0:
        break
        

print(min)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
mod = 2019
min_2019 = min(2019,r-l)
min = 10**9
for i in range(l,min_2019+l):
    j = i+1
    if min > (i*j)%mod:
        min = (i*j)%mod

print(min)

Submission status: Wrong Answer

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

print(min)

Submission status: Wrong Answer

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

s = l % mod
e = r % mod
diff = l-r

if diff >= 2020:
    print(0)

else:
    if s >= e:
        print(0)
    
    else:
        print(s*(s+1)%mod)

Submission status: Wrong Answer

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

s = l % mod
e = r % mod
diff = l-r

if diff >= 2020:
    print(0)

else:
    if s >= e:
        print(0)
    
    else:
        print(s*(s+1))

Submission status: Wrong Answer

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

s = l % mod
e = r % mod

if s >= e:
    print(0)

else:
    print(s*(s+1))

Submission status: Wrong Answer

Solution code:
import sys
L,R = map(int,input().split())
n = 0
if L<2019 and R<2019:
  print((L%2019)*(R%2019))
  sys.exit(0)
print(2)

Submission status: Wrong Answer

Solution code:
import sys
L,R = map(int,input().split())
n = 0
if L<2019 and R<2019:
  print((L%2019)*(R%2019))
  sys.exit(0)
while True:
  if 2019**n > R:
    break
  n += 1
n-=1
A = (L-2019**n)%2019
print(A*(A+1))

Submission status: Wrong Answer

Solution code:
import sys
L,R = map(int,input().split())
n = 0
if L<2019 and R<2019:
  print((L%2019)*(R%2019))
  sys.exit(0)
while True:
  if 2019**n > R:
    break
  n += 1
n-=1
k = 0
while True:
  if L-(2019**n + k) < 0:
    break
  k += 1
print(k**2-k)

Submission status: Wrong Answer

Solution code:

L,R = map(int,input().split())
if R-L >= 2019:
    print(0)
else:
    ans = []
    for i in range(L,R):
        for j in range(L+1,R+1):
            ans.append(i*j*2019)
    print(min(ans))

Submission status: Wrong Answer

Solution code:
import sys
from heapq import heappush, heappop
#input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from heapq import heappush, heappop
#input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product

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

resolve()

Submission status: Wrong Answer

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product

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

resolve()

Submission status: Wrong Answer

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

if a <= b:
  print(a)
else:
  print(0)

Submission status: Wrong Answer

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

l1 = l%2019
r1 = r%2019
if r1 <= l1:
    r1 = 2019

ans = float("inf")
for i in range(l1,r1):
    for j in range(i+1, r1+1):
        ans = min(ans, ((i*j)%2019))

print(ans)

Submission status: Wrong Answer

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

l1 = l%2019
if r >= l + 2019 - l1:
    r1 = 2019
else:
    r1 = r%2019

ans = float("inf")
for i in range(l1,r1):
    for j in range(i+1, r1+1):
        ans = min(ans, (i*j%2019))

Submission status: Wrong Answer

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

l1 = l%2019
if r >= l + 2019 - l1:
    r1 = 2018
else:
    r1 = r%2019

ans = float("inf")
for i in range(l1,r1):
    for j in range(i+1, r1+1):
        ans = min(ans, (i*j%2019))

print(ans)

Submission status: Wrong Answer

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

l1 = l%2019
if r >= l + 2019 - l1:
    r1 = 0
else:
    r1 = l1 + 1

print((l1*r1)%2019 )

Submission status: Wrong Answer

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

l1 = l%2019
if r >= l + 2019 - l1:
    r1 = 0
else:
    r1 = l1 + 1

print(l1*r1)

Submission status: Wrong Answer

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

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)

    # divisors.sort()
    return divisors

l1 = l%2019
if r > l + 2019 - l1:
    r1 = 0
else:
    r1 = l1 + 1

print(l1*r1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
M=2019;l%=M;r%=M;a=M-1
if 0<r-l<672:
  for i in range(l,r):
    for j in range(i+1,r+1):
      a=min(a,i*j%M)
      if a<2: break
    if a<2: break
else: a=0
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = [int(x) for x in input().split()]
NUM = 2019
res = 0
if r // NUM - (l + NUM - 1) // NUM >= 0: #2019の倍数を区間に含む
    res = 0
elif r // 3 - (l + 3 - 1) // 3 >= 0 and r // 673 - (l + 673 - 1) // 673 >= 0:
    res = 0
else: #mod 2019 = 0にできない場合
    res = 2019
    for i in range(l, r + 1):
        for j in range(l, r + 1):
            res = min(res, (i * j) % NUM)
print(res)

Submission status: Wrong Answer

Solution code:
l, r = [int(x) for x in input().split()]
NUM = 2019
if r // NUM - (l + NUM - 1) // NUM >= 0: #2019の倍数を区間に含む
    res = 0
elif r // 3 - (l + 3 - 1) // 3 >= 0 and r // 673 - (l + 673 - 1) // 673 >= 0:
    res = 0
else: #mod 2019 = 0にできない場合
    res = (l%NUM) * ((l + 1)%NUM)
    res %= NUM
print(res)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
M=2019;m=l%M
print([m*-~m%M,0][r//M-l//M>0])

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
M=2019;m=l%M
print([m*-~m,0][r//M-l//M>0])

Submission status: Wrong Answer

Solution code:
def solve():
    N, M = map(int, input().split())
    if M < 2019:
        return (N * (N+1)) % 2019
        
    a = N // 2019
    b = M // 2019

    if (M % 2019 == 0 or N % 2019 == 0) or (M >= 2019 and b-a >= 1):
        return 0
    else:   
        return (a * (a+1)) % 2019
      
print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    N, M = map(int, input().split())
    if M-N >= 2018:
        return 0
    a = N % 2019
    b = N % 2019
    c = min(a, b)
    return (c * (c+1)) % 2019

print(solve())

Submission status: Wrong Answer

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

L,R  = nm()
if R -L >= 2019-1:
    print(0)

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

Submission status: Wrong Answer

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

L,R  = nm()
if R -L >= 673:
    print(0)

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

Submission status: Wrong Answer

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

L,R  = nm()
if R -L >= 673:
    print(0)

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:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

L,R  = nm()
if R -L >= 673:
    print(0)

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

Submission status: Wrong Answer

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

L,R  = nm()
if R -L >= 673:
    print(0)

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

    while(j<=R):
        x = (i * j) % 2019
        if x < min:
            min = x
        j += (2019-x) // s
print(min)

Submission status: Wrong Answer

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

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

min = 2019
for i in range(L,R):
    j = i+1
    s = i % 2019 
    if s == 0:
        print(0)
        exit(0)
        
    while(j<=R):
        x = (i * j) % 2019
        if x < min:
            min = x
        j += (2019-x) // s
print(min)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

A =[]
for i in range(L ,R):
    for j in range(L+1,R+1):
        print(i,j)
        b = i*j % 2019
        A.append(b)
ans = min(A) 
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')

    l, r = L%MOD, R%MOD
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            ret = min(ret, (i * j) % MOD)

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')

    l, r = L%MOD, R%MOD
    for i in range(l, r+1):
        for j in range(l+1, R+1):
            ret = min(ret, (i * j) % MOD)

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')

    for i in range(L%MOD, R%MOD):
        for j in range((L + 1)%MOD, (R + 1)%MOD):
            ret = min(ret, (i * j) % MOD)

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')
    print(L, R)
    for i in range(L, R):
        for j in range(L + 1, R + 1):
            ret = min(ret, (i * j) % MOD)

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import os

MOD = 2019

def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    print((L*(L+1))%MOD)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
saisyo = float("inf")
for i in range(L, R):
    saisyo = min(saisyo, i%2019*(i+1)%2019)
print(saisyo)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
saidai = float("inf")
for i in range(100000):
    for j in range(2019):
        if L<= 2019*i+j < R:
            print(j*(j+1))
            break

Submission status: Wrong Answer

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

i = l
j = i + 1
count = 0
arr = []
while(True):
    if count == 2019*2 or j == r:
        break
    else:
        arr.append((i*j) % 2019)
        j += 1
        count += 1
if len(arr) == 0:
    arr.append((l*r) % 2019)
        
print(min(arr))

Submission status: Wrong Answer

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

i = l
j = i + 1
count = 0
arr = []
while(True):
    if count == 10*6 or j == r:
        break
    else:
        arr.append((i*j) % 2019)
        j += 1
        count += 1
if len(arr) == 0:
    arr.append((l*r) % 2019)
        
print(min(arr))

Submission status: Wrong Answer

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

i = l
j = i + 1
count = 0
arr = []
while(True):
    if count == 10000 or j == r:
        break
    else:
        arr.append((i*j) % 2019)
        j += 1
        count += 1
if len(arr) == 0:
    arr.append((l*r) % 2019)
        
print(min(arr))

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
end = min(R, L + 4038)
ans = 2018

for a in range(L, end):
    for b in range(a + 1, end+ 1):
        tmp = (a * b) % 2019
        print(a, b, tmp)
        if tmp < ans:
            ans = tmp

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
a, b = map(int, input().split())
if b - a >= 2019:
  print(0)
  
else:
  all_ = np.mod([i for i in range(a, b+1)], 2019)

  f1 = min(all_)
  f2 = min(np.delete(all_, np.argmin(all_)))

  print(f1 * f2 % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
a, b = map(int, input().split())
if b - a >= 2019:
  print(0)
  
else:
  all_ = np.mod([i for i in range(a, b+1)], 2019)

  f1 = min(all_)
  f2 = min(np.delete(all_, np.argmin(all_)))

  print(f1 * f2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

A = []

for i in range(a, min(a+4000, b+1)):
    A.append(i%2019)


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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
i = 2017
j = 2018
i_mod = 2017
j_mod = 2018
end = min(R, L + 4038)

for n in range(L, (end + 1)):
    n_mod = n % 2019
    if n_mod < i_mod:
        i, j = n, i
        i_mod, j_mod = n_mod, i_mod
    elif n_mod < j_mod:
        j = n
        j_mod = n_mod

print((i * j) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
i = 2017
j = 2018
i_mod = 2017
j_mod = 2018
end = min(R, L + 4038)

for n in range(L, (end + 1)):
    n_mod = n % 2019
    if n_mod < i_mod:
        i, j = n, i
        i_mod = n_mod
    elif n_mod < j_mod:
        j = n
        j_mod = n_mod

print((i * j) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
i = 2017
j = 2018
i_mod = 2017
j_mod = 2018
end = min(R, L + 4038)

for n in range(L, (R + 1)):
    n_mod = n % 2019
    if n_mod == 0:
        continue
    elif n_mod < i_mod:
        i, j = n, i
        i_mod = n_mod
    elif n_mod < j_mod:
        j = n
        j_mod = n_mod

print((i * j) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
i = 2017
j = 2018
i_mod = 2017
j_mod = 2018
end = min(R, L + 4038)

for n in range(L, (end + 1)):
    n_mod = n % 2019
    if n_mod == 0:
        continue
    elif n_mod < i_mod:
        i, j = n, i
        i_mod = n_mod
    elif n_mod < j_mod:
        j = n
        j_mod = n_mod

print((i * j) % 2019)