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

Submission status: Wrong Answer

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

MOD = 2019
ub = max(R % MOD, L % MOD)
lb = min(R % MOD, L % MOD)

ans = float('inf')
for i in range(lb, ub + 1):
    for j in range(i + 1, ub + 1):
        ans = min(ans, i * j % MOD)
print(ans)

Submission status: Wrong Answer

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

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

mod_set = set()
for i in range(L, R+1):
    mod_set.add(i % 2019)
mod_list = sorted(mod_set)

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000000)
input=lambda : sys.stdin.readline().rstrip()

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

x=l%2019
y=r%2019

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
min2019 = L
while True:
    if min2019 % 2019 == 0:
        break
    else:
        min2019 -= 1

if min2019 + 2019 <= R+1:
    max2019 = 2018
else:
    max2019 = R % 2019

min2019 = L % 2019

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod_n = 2019
if mod_n < (R - L + 1):
    R = L + mod_n

v = []
for i in range(L,R+1):
    v.append(i % mod_n)
v.sort()
#print(v)
ans = (v[0] * v[1]) % mod_n
print(ans)

Submission status: Wrong Answer

Solution code:
MOD = 2019

l, r = sorted(map(lambda x: int(x) % MOD, input().split()))
ret = MOD
for i in range(l, r):
    for j in range(i + 1, r + 1):
        ret = min(ret, (i * j) % MOD)
print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


diff = R - L
l = L%2019
r = R%2019

ans = 2019
if diff >= 2019:
    print(0)
else:
    for i in range(diff):
        x = ((L+i)%2019)*((L+i+1)%2019)
        ans = min(ans,x%2019)
print(ans)

Submission status: Wrong Answer

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

l = l % 2019
r = r % 2019

mod_min = 2019

if l < r:
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            mod = i * j % 2019
            if mod < mod_min:
                mod_min = mod
elif l > r:
    for i in range(r, 2019):
        for j in range(i+1, 2019):
            mod = i * j % 2019
            if mod < mod_min:
                mod_min = mod

    for i in range(l):
        for j in range(i+1, l):
            mod = i * j % 2019
            if mod < mod_min:
                mod_min = mod
else:
    for i in range(2019):
        for j in range(i+1, 2019):
            mod = i * j % 2019
            if mod < mod_min:
                mod_min = mod 

print(mod_min)

Submission status: Wrong Answer

Solution code:
import math

x = input()
x = x.split()

l = int(x[0])
r = int(x[1])

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

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
min2019 = L
while True:
    if min2019 % 2019 == 0:
        break
    else:
        min2019 -= 1

if min2019 + 2019 <= R+1:
    max2019 = 2018
else:
    max2019 = R % 2019

min2019 = L % 2019

print(min2019, max2019)

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

Submission status: Wrong Answer

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

while L>N:
	L -= N
while R>N:
	R -= N
ans = R*L

print(ans%2019)

Submission status: Wrong Answer

Solution code:
MOD = 2019
L ,R = map(int, input().split())
x = L % MOD
y = L % MOD
x = min(x, y)
print(x*(x+1))

Submission status: Wrong Answer

Solution code:
import sys
l,r = map(int,input().split())
l = l % 2019
r = r % 2019
if r <= l:
  print(0)
  sys.exit()
m = 2019
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 = [int(i) for i in input().split()]

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

Submission status: Wrong Answer

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

temp = 2019
for i in range(0,min(r-l,2019)):
    temp = min(temp,(l+i)%2019)
    
print(temp*(temp+1))

Submission status: Wrong Answer

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

X = [x % 2019 for x in range(L, R+1)]
X = sorted(X)
ans = X[0] * X[1]
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ans = 0
L_min = 10**10
R_min = 10**10

for i in range(L,R+1):
  if L_min > i%2019:
    L_min = i%2019
    L_id = i
for i in range(L,R+1):
  if i != L_id:
    if R_min > i%2019:
      R_min = i%2019
print(L_min*R_min)

Submission status: Wrong Answer

Solution code:
L, R = [int(i) for i in input().split()]
l, r = L + (3 - L % 3) % 3, R - R % 673
if l < r:
    print(0)
else:
    print(L * (L + 1) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
l, r = map(int, input().split())
mod = 2019
l_mod = l % mod
r_mod = r % mod
if l <= mod <= r:
    print(0)
elif l_mod < r_mod:
    print(l_mod * (l_mod+1))
else:
    print(r_mod * (r_mod+1))

Submission status: Wrong Answer

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


if r - l >= 2019:
    print(0)
else:
    if l % 2019 < (r % 2019) + 1:
        m = sorted(list(range(l % 2019, (r % 2019) + 1)))
        print(min(m[0]*m[1] , (2019 - m[-1])*(2019 - m[-2])))
    else:
        m = sorted(list(range(l % 2019, (r % 2019) + 2020)))
        print(min(m[0]*m[1] , (2019 - m[-1])*(2019 - m[-2])))

Submission status: Wrong Answer

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

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

if flag:
    print(0)
else:
    lmod = l % 2019
    print((lmod * (lmod + 1)) % 2019)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

high = r % 2019

if (l//2019+1)*2019 > high:
    print((l * (l + 1)) % 2019)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-


MOD = 2019

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


ans = 0
if R-L >= 2019:
  ans = 0
else:
  modset = []
  for i in range(L,R+1):
    modset.append(i % MOD)
  modset=sorted(modset)
  ans = (modset[0]*modset[1]) % MOD
print(ans)

Submission status: Wrong Answer

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

ld = L // MOD
rd = R // MOD

ans = 0
if ld != rd:
    ans = 0
else:
    lm = L % MOD
    ans = lm * (lm + 1)

print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())  # 複数数値入力


lm = l % 2019
rm = r % 2019

if (r - l) + lm < 2019:  # 間に2019の倍数はない
    print(min(lm, rm) * (min(lm, rm) + 1))
else:
    print(0)


# li = [2019, 2019]
# for i in range(l, r + 1):
#     if li[1] > i % 2019:
#         li[1] = i % 2019

#     if li[1] < li[0]:
#         li[0], li[1] = li[1], li[0]

# print(li)
# print(li[0]*li[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = tuple([int(s) for s in input().split()])

n = n % 2019
k = k % 2019

a = n
b = n+1

print(a*b)

Submission status: Wrong Answer

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

ans = 2019
flag = True
for i in range(L, L+2019):
    if flag:
        for j in range(i, L+2019):
            if j > R:
                flag = False
                break
            ans = min(((i % 2019) * (j % 2019)) % 2019, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    L, R = MAP()
    LL = L % 2019
    RR = R % 2019
    if LL >= RR:
        print(0)
    else:
        minv = 2019
        for l in range(LL, RR):
            for r in range(l + 1, RR + 1):
                minv = min(minv, (l * r) % 2019)
        print(minv)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
r1 = 2019
r2 = 2020
for i in range(L, R+1):
    if L%2019==0:
        r1=0
        break
    elif i%2019<r1:
        r1 = i%2019
    elif i%2019<r2:
        r2 = i%2019
print(r1*r2)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    L, R = map(int, input().split())
    if R - L >= 2019:
        print(0)
    elif R % 2019 <= L % 2019:
        print(0)
    else:
        min_value = 2020
        for i in range(L, R + 1):
            for j in range(L + 1, R + 1):
                mod_value = (i * j) % 2019
                min_value = min(mod_value, min_value)
        print(min_value)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

x = L // 2019
y = R // 2019

if x != y:
    print(0)
else:
    print(L * (L+1) % 2019)

Submission status: Wrong Answer

Solution code:
l,r  = map(int,input().split())
small = l // 2019
big = r // 2019
num = [l % 2019,r % 2019,l % 2019 + 1,r % 2019 - 1]
num.sort()
num = list(set(num))
if big - small != 0:
    print(0)
else:
    print(num[0] * num[1])

Submission status: Wrong Answer

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

if l==0 or r//mod - (l-1)//mod >= 1:
  print(0)
else:
  print(l*(l+1)%mod)

Submission status: Wrong Answer

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

left = L // 2019
right = R // 2019

if left != right:
    print(0)
else:
    left_edge = (L) * (L - 1) % 2019
    right_edge = (R) * (R - 1) % 2019
    print(min(left_edge, right_edge))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l = L % 2019
r = R % 2019
lr = l*r % 2019

print(l*(l+1))

Submission status: Wrong Answer

Solution code:
import math

x = input()
x = x.split()

l = int(x[0])
r = int(x[1])

if l % 2019 > r % 2019:
  print("0")
  exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

# 2019の倍数があればmod 2019で0になる。
if L == 0:
    print(0)
elif (L / 2019 >= 1) or (R / 2019 >=1):
    print(0)
else:
    print((L * (L+1)) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 0 <= l < r and l + 1 != r:
    minimo = (l * r) % 2019
    for c in range(l, r):
        s = (c * c+1) % 2019

        if s < minimo:
            minimo = s
else:
    minimo = l * r

print(minimo)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
c = []
d = 0
for i in range(a, b + 1):
    c.append([i % 2019, i])
    d += 1
    if d > 2019 * 3:
        break
c.sort()
print((c[0][0] * c[1][0]) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

    if R // 2019 > (L-1) // 2019:
        return 0

    if R - L >= 3 and R // 673 > (L-1) // 673:
        return 0

    left = L % 2019
    return left * (left + 1)


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import itertools
L,R = map(int,input().split())
if R-L >= 2018:
  print(0);exit()
li = [i%2019 for i in range(L,R+1)]
li = list(set(li))
if 0 in li or 3 in li or 673 in li:
  print(0);exit()
pro = []
for i,j in itertools.combinations(li,2):
  pro.append(i*j%2019)
print(min(pro))

Submission status: Wrong Answer

Solution code:
l, r = [int(elem) for elem in input().split()]

res = 0
if (r / 2019) - (l / 2019) < 1:
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            tmp = (i * j) % 2019
            if tmp < res:
                res = tmp
            elif res == 0:
                res = tmp
    print(res)
else:
    print(0)

Submission status: Wrong Answer

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

if L + 1 == R:
    print((L*R) % 2019)
else:
    val = 2019
    for i in range(L, R):
        for j in range(i + 1, R):
            tmp = (i*j) % 2019
            val = tmp if val > tmp else val

    print(val)

Submission status: Wrong Answer

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

border = (R//2019 - L//2019)

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L1 = L%2019
R1 = R%2019
L2 = L//2019
R2 = R//2019
#print(L1)
#print(R1)
if L2 != R2:#LとRの間に0でなるとき
  ans = 0
else:
  ans = L1*(L1+1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
if R//2019 - L//2019 > 0:
    print(0)
elif R//673 - L//673 > 0 and R-L > 2:
    print(0)
else:
    lans = (L%2019) * (L%2019 + 1)
    print(lans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
input_data=input().split()
l = int(input_data[0])
r = int(input_data[1])

new_l = l % 2019
new_r = r % 2019

answer = new_l*(new_l+1)
print(answer)

Submission status: Wrong Answer

Solution code:
MOD = 2019

l, r = map(lambda x: int(x) % MOD, input().split())
ret = MOD
for i in range(l, r):
    for j in range(i + 1, r + 1):
        ret = min(ret, (i * j) % MOD)
print(ret)

Submission status: Wrong Answer

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

ml = l % 2019
mr = r % 2019

if ml >= mr:
    print(0)
else:
    mi = (ml * (ml+1)) % 2019
    for i in range(ml,mr-1):
        for j in range(ml+1, mr):
            mi = min(mi, (i*j) % 2019)
    print(mi)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l_mod = l % 2019
r_mod = r % 2019
if l_mod == 0 or r_mod == 0 or l_mod >= r_mod:
  print(0)
else:
  ans = 2019
  for i in range(l_mod, r_mod):
    for j in range(i + 1, r_mod + 1):
      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
if(a >= b):
    print(0)
elif(r-l >= 2019):
    print(0)
else:
    print((l*(l+1))%2019)

Submission status: Wrong Answer

Solution code:
L, R = (map(int, input().split()))
min_2 = [2018, 2018]

for i in range(L, R + 1):
	val = i % 2019
	if val < min_2[-1] and val < min_2[0]:
		tmp = min_2[0]
		min_2[0] = val
		min_2[1] = tmp
	if val < min_2[-1] and val > min_2[0]:
		min_2[1] = val
		
print((min_2[0] * min_2[1]) % 2019)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
l, r = map(int, input().split())
mod = 2019
l_mod = l % mod
r_mod = r % mod
if l_mod < r_mod:
    print(l_mod * (l_mod+1))
else:
    print(r_mod * (r_mod+1))

Submission status: Wrong Answer

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

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

mod_set = set()
for i in range(L, R+1):
    mod_set.add(i % 2019)
mod_list = sorted(mod_set)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l = l % 2019
r = r % 2019

mod_min = 2019

if l < r:
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            mod = i * j % 2019
            if mod < mod_min:
                mod_min = mod
else:
    for i in range(r, 2019):
        for j in range(i+1, 2019):
            mod = i * j % 2019
            if mod < mod_min:
                mod_min = mod

    for i in range(l):
        for j in range(i+1, l):
            mod = i * j % 2019
            if mod < mod_min:
                mod_min = mod

print(mod_min)

Submission status: Wrong Answer

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

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

min = 2019

if R - L > 2019:
    R = L + 2019

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

print(min)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
a=set()
for i in range(l,r+1):
    if i%2019==0:
        print(0)
        exit()
    a.add(i%2019)
a=sorted(a)
print(a[0]*a[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = [int(i) for i in input().split()]
r=r%2019
l=l%2019
m=10**10
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())
e = 2019
if r < e:
    print(divmod(r*(r-1),e)[-1])
elif e < l:
    print(divmod(l*(l+1),e)[-1])
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

NUM = 2019

a = R // NUM

i = max(NUM * a, L)
j = i + 1

print((i * j) % NUM)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

MOD = 2019  # type: int

def solve(L: int, R: int):
    # L = min(L,2019)
    # R = min(R,2019)
    L = L % 2019
    R = R % 2019

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

    print(ans)
    return


# Generated by 1.1.4 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 sys

input = sys.stdin.readline

L, R = map(int, input().strip().split(' '))
l = L % 2019
r = R % 2019
if l >= r or R - L >= 2019:
    print(0)
else:
    minimum = l * r % 2019
    for i in range(l, r):
        for j in range(i+1, r-1):
            minimum = min(minimum, (i*j) % 2019)
    print(minimum)

Submission status: Wrong Answer

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

l=l%2019
r=r%2019

if l>r:
    tmp=r
    r=l
    l=tmp

ans=l*r%2019
for l1 in range(l,r):
    for r1 in range(l1+1,r+1):
        ans=min(ans,l1*r1%2019)

print(ans)

Submission status: Wrong Answer

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

m=2019

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if(L==2019):
	print(0)
elif(L<2019):
	print((L*(L+1)%2019))
else:
	m = 2
	if(L*m<=R):
		print(0)
	else:
		print((L*(L+1)%2019))

Submission status: Wrong Answer

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

left = L // 2019
right = R // 2019

if left != right:
    print(0)
else:
    left_edge = (L % 2019) * ((L + 1) % 2019) % 2019
    right_edge = (R % 2019) * ((R - 1) % 2019) % 2019
    print(min(left_edge, right_edge))

Submission status: Wrong Answer

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

minMod= 2019

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

print(minMod)

Submission status: Wrong Answer

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

MOD = 2019
ub = max(R % MOD, L % MOD)
lb = min(R % MOD, L % MOD)

ans = float('inf')
while ub - lb > 0:
    mid = (ub + lb) // 2
    cnt = ub * lb % MOD
    
    if ub - lb == 1:
        ans = min(ans, cnt)
        break
    
    if ans > cnt:
        ub = mid
        ans = cnt
    else:
        lb = mid
        
print(ans)

Submission status: Wrong Answer

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

num = L*(L+1)

ans = 1e+1000
while True:
    if num > L*R:
        break
    
    mod = num % 2019
    if num % 2019 < ans:
        ans = mod
    else:
        pass
    num += L
print(ans)

Submission status: Wrong Answer

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

first = 2020
second = 2020
for n in range(L, R+1):
    mod = n%2019
    if mod < first:
        first, second = mod, first
    elif mod < second:
        second = mod
print(first * second)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=(int(x) for x in input().split())
L_mod=L%2019
R_mod=R%2019
if L_mod>=R_mod:
    print(0)
else:
    if L+2019<=R:
        print(0)
    else:
        print(L_mod*(L_mod+1))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000000)
input=lambda : sys.stdin.readline().rstrip()

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

x=l%2019
y=r%2019

if x>=y or r-l>=2019 or x==0:
    print(0)
else:
    ans=99999
    for i in range(x,y+1):
        for j in range(x+1,y+1):
            ans=min(ans,i*j)
    print(ans)

Submission status: Wrong Answer

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

if(diff >= 2019):
  print(0)
else:
  lmod = l % 2019
  rmod = r % 2019
  if(rmod  < lmod):
    print(0)
  else:
    print((l*(l+1)%2019))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

# 0<= L < R <= 2*10^9 
L, R = [int(x) for x in stdin.readline().rstrip().split()]
MODN = 2019

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

ans = INF
for i in range(L, L + 2019 + 1):
    if i > R:
        break
    for j in range(i+1, L + 2019 + 1):
        if j > R:
            break

        tmp = (i * j) % MODN
        ans = min(ans, tmp)

print(ans)

Submission status: Wrong Answer

Solution code:
[l,r] = [int(i) for i in input().split()]
i = 0
check = 1
ans = 0
p = l % 2019
q = r % 2019
# 2019の倍数が挟まっている
if p >= q or r - l >= 2019:
    print(0)
else:
    print(min(p,q) * (min(p,q)+1))

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
L_2019 = L%2019
R_2019 = R%2019
ans1 = 2019
if R_2019 < L_2019 :
    print(0)
else:
    for i in range(L_2019,R_2019):
        for j in range(i+1,R_2019+1):
            ans2 = (i*j)%2019
            ans1 = min(ans1,ans2)
print(ans1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#C問題
L,R = map(int,input().split())
r = R%2019
l = L%2019
MIN = 2019
if R-L >= 2019:
    for i in range(2019):
        I = i+l
        for j in range(2019):
            J = j+l+1
            kari = I*J%2019
            MIN = min(MIN,kari)
else:
    for i in range(r-l+1):
        I = i+l
        for j in range(r-l):
            J = j+l+1
            kari = I*J%2019
            MIN = min(MIN,kari)
print(MIN)

Submission status: Wrong Answer

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
base = 2019
L,R = LI()
l = L % base
r = R % base

ans = mod
for i in range(l,r):
    for j in range(i+1,r+1):
        i = i % base
        j = j % base
        ans = min(ans,i * j % base)
        if ans == 1:
            break
    else:
        continue
    break
print(ans)

Submission status: Wrong Answer

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

min_i = 2020
for i in range(L, R):
    mod_i = i % 2019
    if min_i > i % 2019:
        min_i = mod_i
        min_j = mod_i + 1
        if min_i == 0:
            break

print(min_i * min_j)