Problem:


Score : 300 points

Problem Statement

You are given two non-negative integers L and R.
We will choose two integers i and j such that L \leq i < j \leq R.
Find the minimum possible value of (i \times j) \mbox{ mod } 2019.

Constraints

All values in input are integers.

0 \leq L < R \leq 2 \times 10^9

Input

Input is given from Standard Input in the following format:

L R

Output

Print the minimum possible value of (i \times j) \mbox{ mod } 2019 when i and j are chosen under the given condition.

Sample Input 1

2020 2040

Sample Output 1

2

When (i, j) = (2020, 2021), (i \times j) \mbox{ mod } 2019  = 2.

Sample Input 2

4 5

Sample Output 2

20

We have only one choice: (i, j) = (4, 5).



Sample input:
2020 2040


Sample output:
2

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readlines
from math import sqrt

def isSquare(n):
    m = int(sqrt(n))
    for x in range(m-2, m+2):
        if x**2 == n:
            return True

def getDistance(xi, xj, dimention):
    d = 0
    for i in range(dimention):
        d += (xi[i] - xj[i])**2
    return d

def main():
    lines = input()

    n, d = list(map(int, lines[0].split()))
    x = []
    for i, xi in enumerate(lines[1:]):
        x.append(list(map(int, xi.split())))

    cnt = 0

    for i, xi in enumerate(x):
        for j, xj in enumerate(x[i+1:]):
            dist = getDistance(xi, xj, d)
            if isSquare(dist):
                cnt += 1
    print(cnt)

main()

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
Dif = abs(L-R)+1
if Dif >= 2040:
    Ans = 0
else:
    Box = []
    for i in range(L,R+1):
        Box.append(i%2019)
    Box.sort()
    Ans = min((Box[0]*Box[1])%2019, Box[-1]*Box[-2]%2019)
print(Ans%2019)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readlines
from math import sqrt

def isSquare(n):
    m = int(sqrt(n))
    for x in range(m-1, m+1):
        if x**2 == n:
            return True

def getDistance(xi, xj, dimention):
    d = 0
    for i in range(dimention):
        d += (xi[i] - xj[i])**2
    return d

def main():
    lines = input()

    n, d = list(map(int, lines[0].split()))
    x = []
    for i, xi in enumerate(lines[1:]):
        x.append(list(map(int, xi.split())))

    cnt = 0

    for i, xi in enumerate(x):
        for j, xj in enumerate(x[i+1:]):
            dist = getDistance(xi, xj, d)
            if isSquare(dist):
                cnt += 1
    print(cnt)

main()

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
Dif = abs(L-R)+1
if Dif >= 2040:
    Ans = 0
else:
    Box = []
    for i in range(L,R+1):
        Box.append(i%2019)
    Box.sort()
    Ans = Box[0]*Box[1]
print(Ans%2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
Dif = abs(L-R)+1
if Dif >= 2040:
    Ans = 0
else:
    Box = []
    for i in range(L,R+1):
        Box.append(i%2019)
    Box.sort()
    Ans = Box[0]*Box[1]
print(Ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
Dif = abs(L-R)+1
if Dif >= 2019:
    Ans = 0
else:
    Box = []
    for i in range(L,R+1):
        Box.append(i%2019)
    Box.sort()
    Ans = Box[0]*Box[1]
print(Ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
dif = r - l
ans = 0
if dif >= 2019:
    ans = 0
else:
    mod_l = l % 2019
    mod_r = r % 2019
    if mod_l < mod_r:
        if 3 >= mod_l and mod_r >= 673:
            ans = 0
        else:
            ans = mod_l * (mod_l + 1)
    else:
        ans = 0
#print(dif, mod_l, mod_r)
print(ans%2019)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
dif = r - l
ans = 0
if dif >= 2019:
    ans = 0
else:
    mod_l = l % 2019
    mod_r = r % 2019
    if mod_l < mod_r:
        if 3 >= mod_l and mod_r <= 673:
            ans = 0
        else:
            ans = mod_l * (mod_l + 1)
    else:
        ans = 0
#print(dif, mod_l, mod_r)
print(ans%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

MOD = 2019
L, R = map(int, input().split())
mod_l = L % MOD
mod_r = R % MOD

if R - L >= 2019:
    print("0")
else:
    ans = 2018
    for i in range(mod_l, mod_r):
        mod_i = i % MOD
        for j in range(i+1, mod_r+1):
            mod_j = j % MOD
            _ans = (mod_i * mod_j) % MOD
            if ans > _ans:
                ans = _ans
            if _ans == 0:
                print(i, j)
    print(ans)

Submission status: Wrong Answer

Solution code:

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

if R - L >= 2019:
    print("0")
else:
    ans = 2018
    for i in range(L, R):
        mod_i = i % MOD
        for j in range(i+1, R+1):
            mod_j = j % MOD
            _ans = (mod_i * mod_j) % MOD
            if ans > _ans:
                ans = _ans
            if _ans == 0:
                print(i, j)
    print(ans)

Submission status: Wrong Answer

Solution code:

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

if R - L > 2019:
    print("0")
else:
    ans = 2018
    for i in range(L, R):
        mod_i = i % MOD
        for j in range(i+1, R+1):
            mod_j = j % MOD
            _ans = (mod_i * mod_j) % MOD
            if ans > _ans:
                ans = _ans
            if _ans == 0:
                print(i, j)
    print(ans)

Submission status: Wrong Answer

Solution code:

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

if R - L > 2019:
    print("1")
else:
    ans = 2018
    for i in range(L, R):
        mod_i = i % MOD
        for j in range(i+1, R+1):
            mod_j = j % MOD
            _ans = (mod_i * mod_j) % MOD
            if ans > _ans:
                ans = _ans
    print(ans)

Submission status: Wrong Answer

Solution code:

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

if R - L >= 2019:
    print("1")
else:
    ans = 2018
    for i in range(L, R):
        mod_i = i % MOD
        for j in range(i+1, R+1):
            mod_j = j % MOD
            _ans = (mod_i * mod_j) % MOD
            if ans > _ans:
                ans = _ans
    print(ans)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
k = 0
l = 2020
m = 2020
apList = [0]*2019
for i in range(L,R+1):
  k = i % 2019
  if apList[k] != 0:
    break
  else:
    apList[k] += 1
for i in range(2019):
  if apList[i] != 0 and l == 2020:
    l = i
  elif apList[i] != 0 and l != 2020 and m == 2020:
    m = i
print(l*m%2019)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
k = 0
l = 2020
m = 2020
apList = [0]*2019
for i in range(L,R+1):
  k = i % 2019
  if apList[k] != 0:
    break
  else:
    apList[k] += 1
for i in range(2019):
  if apList[i] != 0 and l == 2020:
    l = i
  elif apList[i] != 0 and l != 2020 and m == 2020:
    m = i
print(l*m)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
k = 0
l = 2020
m = 2020
apList = [0]*2019
for i in range(L,R):
  k = i % 2019
  if apList[k] != 0:
    break
  else:
    apList[k] += 1
for i in range(2019):
  if apList[i] != 0 and l == 2020:
    l = i
  elif apList[i] != 0 and l != 2020 and m == 2020:
    m = i
print(l*m)

Submission status: Wrong Answer

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

def mod(num):
    return num % 2019


#  (2019a + x)(2019b + y) = 2019(n) + xy

ans = 10 ** 9

lr = min(R, L + 2019)

for i in range(L, lr):
    for j in range(i + 1, lr):
        ans = min(ans, mod(i * j))
        
print(ans)

Submission status: Wrong Answer

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

def mod(num):
    return num % 2019


#  (2019a + x)(2019b + y) = 2019(n) + xy

if mod(L) * mod(R) == 0:
    print(0)

elif L // 2019 != R // 2019:
    print(0)

else:
    print(min(mod(L * (L + 1)), mod((R - 1) * R)))

Submission status: Wrong Answer

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

def mod(num):
    return num % 2019

t1 = 10 ** 9
t2 = 10 ** 9

for i in range(R, L + 1, -1):
    if mod(i) < t1:
        t2 = t1
        t1 = mod(i)

if R - L == 1:
    print(mod(L * R))
else:
    print(mod(t1 * t2))

Submission status: Wrong Answer

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

def mod(num):
    return num % 2019

l = mod(L)
r = mod(R)

if l > r or (R - L) > 2019:
    print(0)

else:
    print(min(mod(l * (l + 1)), mod((r - 1) * r)))

Submission status: Wrong Answer

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

def mod(num):
    return num % 2019

l = mod(L)
r = mod(R)

if l > r or (L - R) > 2019:
    print(0)

else:
    print(min(mod(l * (l + 1)), mod((r - 1) * r)))

Submission status: Wrong Answer

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

def mod(num):
    return num % 2019

l = mod(L)
r = mod(R)

if l > r:
    print(0)

else:
    print(min(mod(l * (l + 1)), mod((r - 1) * r)))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

for i in range(L,R+1):
    if i % 2019 == 0 or i % 3 == 0 or i % 673 == 0:
        print(0)
        exit(0)
    else:
        print(min(L*(L+1)%2019,R*(R-1)%2019))
        exit(0)

Submission status: Wrong Answer

Solution code:
import math

L,r=map(int, input().split())
l=[n%2019 for n in range(L,r+1)]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
a = L%2019
b = R%2019
N = 2018
if R-L>=2019:
  print(2)
elif R-L<2019 and b>a:
  print((a*(a+1))%2019)
elif R-L<2019 and b<=a:
  print(2)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
a = L%2019
b = R%2019
N = 2018
if R-L>=2019:
  print(2)
elif R-L<2019 and b>a:
  print(a*(a+1))
elif R-L<2019 and b<=a:
  print(2)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
a = L%2019
b = R%2019
N = 2018
if R-L>=2019:
  print(2)
elif R-L<2019 and b>a:
  print(b*(b+1))
elif R-L<2019 and b<=a:
  print(2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod=2019

l=L%mod if L<=mod else 0
r=R%mod if R<=mod else 0
m=min(l,r)

print(m*(m+1))

Submission status: Wrong Answer

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

mod=2019

l=L%mod if L<=2*mod else 0
r=R%mod if R<=2*mod else 0
m=min(l,r)

print(m*(m+1))

Submission status: Wrong Answer

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

mod=2019

l=L%mod
r=R%mod
m=min(l,r)

print(m*(m+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ls = [i % 2019 for i in range(L,R+1)]
ls.sort()

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l %= 2019
r %= 2019
ans = float('inf')
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 bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    l,r = LI()
    num = r-l+1
    ans = 0
    if num < 2019:
        lst = [i%2019 for i in range(l,r+1)]
        lst.sort()
        ans = (lst[0]*lst[1] % 2019)


    print(ans)
main()

Submission status: Wrong Answer

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

if (R - L) >= 2019:
    print(0)
else:
    ans = math.inf
    for i in range(L, R):
        for j in range(i+1, R+1):
            ans = min(ans, (i%2019)*(j%2019))
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=[int(x) for x in input().split()]
l=l%2019
r=r%2019
i=min(l,r)
print((i*(i+1))%2019)

Submission status: Wrong Answer

Solution code:
n = list(map(int, input().split(' ')))
a = n[0]
b = n[1]
print((a*b)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split(" "))
c = [i*(i+1) for i in range(a,b+1)]
d = sorted(c)
print(d[0]%2019)

Submission status: Wrong Answer

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

x=[]
for i in range(L,R+1):
   x.append(i%2019)

x=sorted(x)
print((x[0]*x[1])%2019)

Submission status: Wrong Answer

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

x=[]
for i in range(L,R+1):
   x.append(i%2019)

x=sorted(x)
print(x[0]*x[1])

Submission status: Wrong Answer

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

a=0

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

if a>0:
  print('0')

ans=[]
if a==0:
  for k in range(l,r):
    num=(k*(k+1)%2019)
    ans.append(num)
  print(min(ans))

Submission status: Wrong Answer

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

a=0

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

if a>0:
  print('0')

ans=[]
if a==0:
  for k in range(l,r+1):
    num=(k*(k+1)%2019)
    ans.append(num)
  print(min(ans))

Submission status: Wrong Answer

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

a=0

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

b=0

for j in range(l,r+1):
  if j%2019>0:
    b+=1

if a>0:
  print('0')

ans=[]
if a==0 and b>0:
  for k in range(l,r+1):
    num=(k*(k+1)%2019)
    ans.append(num)
  print(min(ans))

Submission status: Wrong Answer

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

cnt=[]


for j in range(l,r+1):
    if j%2019>=0:
      a=(l*(l+1)%2019)
      cnt.append(a)
      break
    else:
      a=(j*(j+1)%2019)
      cnt.appnd(a)
      break
print(min(cnt))

Submission status: Wrong Answer

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

cnt=[]


for i in range(l,r+1):
  for j in range(l,r+1):
    if j%2019>=0:
      a=(l*(l+1)%2019)
      cnt.append(a)
      break
    else:
      a=(j*(j+1)%2019)
      cnt.appnd(a)
      break
print(min(cnt))

Submission status: Wrong Answer

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

cnt=[]


for i in range(l,r+1):
  if i%2019!=0:
    for j in range(l,r+1):
      if j%2019>=0:
        a=(l*(l+1)%2019)
        cnt.append(a)
        break
      else:
        a=(j*(j-1)%2019)
        cnt.appnd(a)
        break
print(min(cnt))

Submission status: Wrong Answer

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

if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L == 1:
    print((R*L)%2019)
    sys.exit()

ans = 4000

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

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = 2019
ij_mod_min = 2019  # 解答の初期値を2019に設定
for i in range(L, R):  # 二重のforで全探索
    for j in range(i+1, R+1):
        ij_mod = ((i % mod)*(j % mod))
        if ij_mod_min > ij_mod:
            ij_mod_min = ij_mod
        if ij_mod_min == 0:  # もし解が0になったら探索をやめる
            break
    else:
        continue
    break
print(ij_mod_min)

Submission status: Wrong Answer

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

if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L == 1:
    print((R*L)%2019)
    sys.exit()

ans = 100*100

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

print(ans)

Submission status: Wrong Answer

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

if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L == 1:
    print((L*R)%2019)
    sys.exit()

ans = 10**10

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

print(ans)

Submission status: Wrong Answer

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

if r//673 > (l-1)//673 and r//3 >(l-1)//3:
  print('0')

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

Submission status: Wrong Answer

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

if r//673 > (l-1)//673 and r//3 >(l-1)//3:
  print('0')

else:
    a=((l%2019) * ((l+1)%2019) % 2019)
    b=((l%2019)%2019 * ((l+1)%2019))
    print(min(a,b))

Submission status: Wrong Answer

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

if r//673 > (l-1)//673 and r//3 >(l-1)//3:
  print('0')

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

Submission status: Wrong Answer

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

if r//673 > (l-1)//673 and r//3 >(l-1)//3:
  print('0')

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

Submission status: Wrong Answer

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

if r//673 > (l-1)//673 and r//3 >(l-1)//3:
  print('0')

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

Submission status: Wrong Answer

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

if r//673 > (l-1)//673 and r-l == 2:
  print('0')

elif r//2019 > (l-1)//2019:
  print('0')

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

Submission status: Wrong Answer

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

if r//673 > (l-1)//673 and r-l == 2:
  print('0')

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

Submission status: Wrong Answer

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

if r//673 > (l-1)//673:
  print('0')

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

Submission status: Wrong Answer

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

if r//2019 > (l-1)//2019:
  print('0')

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

Submission status: Wrong Answer

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

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

L %= 2019
R %= 2019
R += 2019

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

Submission status: Wrong Answer

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

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

L %= 2019
R %= 2019

if L > R:
  L,R = R,L

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

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

Submission status: Wrong Answer

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

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

L %= 2019
R %= 2019

if L > R:
  L,R = R,L

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

Submission status: Wrong Answer

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

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

L %= 2019
R %= 2019

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

Submission status: Wrong Answer

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

import itertools

if r <= l:
    ans = 0
else:
    for i, j in itertools.combinations(range(l, r + 1), 2):
        ans = min(ans, (i * j) % 2019)
        
print(ans)

Submission status: Wrong Answer

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

import itertools

if r < l:
    ans = 0
else:
    for i, j in itertools.combinations(range(l, r + 1), 2):
        ans = min(ans, (i * j) % 2019)
        
print(ans)

Submission status: Wrong Answer

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

import itertools

if r < l: 
    ans = 0
else:
    for i, j in itertools.combinations(range(l, r + 1), 2):
        ans = min(ans, (i * j) % 2019)
        
print(ans)

Submission status: Wrong Answer

Solution code:
i,j = map(int,input().split())
a,b = divmod(i,2019)
c,d = divmod(j,2019)


if c-a > 0:
    ans = 0
else:
    ans = (i*(i+1)) %2019
print(ans)

Submission status: Wrong Answer

Solution code:
i,j = map(int,input().split())
a,b = divmod(i,2019)
c,d = divmod(j,2019)


if c-a > 0:
    ans = 0
else:
    ans = b*(b+1)
print(ans)

Submission status: Wrong Answer

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

sho_l = l // 2019
sho_r = r // 2019

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

Submission status: Wrong Answer

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

sho_l = l // 2019
sho_r = r // 2019

if sho_r-sho_l >= 1:
  print(0)
else:
  print(l*(l+1)%2019)

Submission status: Wrong Answer

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

if R - L < 2019:
    tmp = R - L
    L = L % 2019
    R = L + tmp
    i = min([j%2019 for j in range(L, R+1)])
else:
    L = L % 2019
    i = min([j%2019 for j in range(L, L+2020)])
print((i*(i+1)) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
m = 10**18
if R-L>=2019:
    print(0)
else:
    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:
L,R = map(int,input().split())
m = 10**18
if R-L>=2019:
    print(0)
else:
    for i in range(L,R):
        s =  i%2019
        for j in range(L+1,R+1):
            ss = j%2019
            m = min(m,s*ss)
            print(m)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
m = 10**18

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
m = 10**18

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

l = L%2019
r = R%2019

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

Submission status: Wrong Answer

Solution code:
from itertools import combinations

l, r = map(lambda s: int(s) % 2019, input().split())
if r < l or l == 0:
    print(0)
else:
    print(min((i * j) % 2019 for i, j in combinations(range(l, r + 1), 2)))

Submission status: Wrong Answer

Solution code:
l, r = map(lambda s: int(s) % 2019, input().split())
print((0, (l * (l + 1)) % 2019)[l < r])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if R-L>2019 or L>R :
    print(0)
    exit()
if L%2019+(R-L)>=2019 :
    print(0)
    exit()
l1=L%2019
r1=R%2019

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

print( ans )

Submission status: Wrong Answer

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

if R-L>2019 or L>R :
    print(0)
    exit()
if L%2019+(R-L)>=2019 :
    print(0)
    exit()
l1=L%2019
r1=R%2019

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

print( ans )

Submission status: Wrong Answer

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

if R-L>2019 or L>R :
    print(0)
    exit()
if L%2019+(R-L)>2019 :
    print(0)
    exit()

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

print( ans )

Submission status: Wrong Answer

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

if R-L>2019 or L>R :
    print(0)
    exit()
if L%2019+(R-L)>2019 :
    print(0)
    exit()

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

print( ans )

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

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


if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    l,r = map(int, input().split())
    year = 2019
    m = []
    for i in range(l,l+2020):
        m.append(i%year)
        if i == r:
            break
    m.sort()
    print(m[0]*m[1])


if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

M=[]
c=0
for i in range(l,r+1):
    m = i%2019
    M.append(m)
    if m==0 :
        c+=1
        if c==2 :
            break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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