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

lmod=l%2019
rmod=r%2019

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
[l,r] = [int(i) for i in input().split()]
i = 0
check = 1
ans = 0
l = l % 2019
r = r % 2019
if l >= r:
    print(0)
else:
    print(l * (l+1))

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((a*(a+1))%2019)

Submission status: Wrong Answer

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

l %= 2019
r %= 2019

min = 2020
for i in range(l, r):
    for j in range(i+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())


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

Submission status: Wrong Answer

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

L2, R2 = L % MOD, R % MOD
ans = float('inf')
for i in range(L, L + 2020):
    for j in range(L + 1, L + 2020):
        if (i > R) or (j > R):
            continue
        ans = min(ans, (i * j) % MOD)

if L == R:
    print((L * R) % MOD)
else:
    print(ans if ans != float('inf') else 0)

Submission status: Wrong Answer

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

for i in range(l, r):
    for j in range(l + 1, r + 1):
        if j <= i:
            continue
        else:
            ans = min(ans, i * j % MOD)

print(ans)

Submission status: Wrong Answer

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


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

lm = l % mod
rm = r % mod

if lm >= rm:
    print(0)
else:
    print(lm * (lm + 1) % mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
e = 2019
if r < e or e < l:
    print(divmod(l,e)[-1] * divmod(l+1,e)[-1])
else:
    print(0)

Submission status: Wrong Answer

Solution code:

def solve(L, R):
    M = 2019
    I = 0
    for i in range(L, R):
        m = i % 2019 
        if m == 0:
            return 0
        if m == M:
            I = i
            break
        if m < M:
            M = m
            I = i
    M = 2019
    J = I+1
    for i in range(I+1, R):
        m = i % 2019 
        if m == 0:
            return 0
        if m == M:
            J = i
            break
        if m < M:
            M = m
            J = i
    print(I, J)
    return (I * J) % 2019

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

    print(solve(L, R))

main()

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:
    print(L_mod*(L_mod+1))

Submission status: Wrong Answer

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

if L % d > R % d: print(0)
else: print((L%d)*(L+1)%d)

Submission status: Wrong Answer

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


if (R-L+1) >= 2019 or L == 0:
    print(0)
else:    
    left = L % 2019
    c = 2019 - left
    if L + c <= R:
        ans = 0
    else:
        ans = (L%2019) * ((L+1)%2019)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = list(map(int, input().split(' ')))
mod = 2019
s1 = l % mod
s2 = r % mod
rem = mod - s1
if l + rem > r:
    # choose l and l+1
    print(((l%mod) * (l+1%mod)) % mod) 
else:
    if l + rem == r:
        # choose l, r 
        print(((r%mod) * (l%mod)) % mod)
    else:
        # choose r-1, r
        print(((r%mod) * (r-1%mod)) % mod)

Submission status: Wrong Answer

Solution code:
import sys

fin = sys.stdin.readline

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

if r - l > 10000:
    print(0)

else:
    num = list(range(l, r + 1))
    num = [n % 2019 for n in num]
    a = min(num)
    num.remove(a)
    b = min(num)
    print(a * b)

Submission status: Wrong Answer

Solution code:
import sys, math

readline = sys.stdin.readline

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

P = 2019
L_ = (L // P) * P

if R < L_ + P:
    print((L - L_) * (L + 1 - L_))
else:
    print(0)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

min = 2018
min_l = 0
for i in range(L, R):
    i_2019 = i % 2019
    if i_2019 <= min:
        min = i_2019
        min_l = L

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def main():
    left, right = map(int, input().split())
    mod = 2019

    # a, b = left, left + 1
    # c, d = right, right - 1
    aaa = defaultdict(int)
    for i in range(left, min(right + 1, left + 5000)):
        aaa[i % mod] += 1

    score_sorted = list(sorted(aaa.items(), key=lambda x: x[0]))

    # print(score_sorted)

    if score_sorted[0][1] >= 2:
        a, b = score_sorted[0][0], score_sorted[0][0]
    else:
        a, b, = score_sorted[0][0], score_sorted[1][0]

    print((a * b)% mod)






if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


mi = 2020
for i in range(l,min(l+2019+1,r+1)):
	mi = min(mi,i%2019)
print(mi * (mi + 1))

Submission status: Wrong Answer

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

x = L % 2019

l = (x + 1) * 2019

if (l+1) > R:
    print(L * (L+1) % 2019)
else:
    print(l * (l+1) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if R >= L + 2019:
    print('0')
elif R == L + 1:
    print((L * R) % 2019)
else:
    xs = [x % 2019 for x in range(L, R + 1)]
    xs = sorted(xs)
    print((xs[0] * xs[1]) % 2019)

Submission status: Wrong Answer

Solution code:
def solve():
  l,r = (int(i) for i in input().split())
  mod = 2019
  l %= mod
  r %= mod
  ans = 10**15
  if l >= r:
    print(0)
    exit()
  else:
    for i in range(l,r):
      for j in range(l+1,r+1):
        ans = min(ans,(i*j)%mod)
  print(ans%mod)

solve()

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if (l//2019) == (r//2019):
    num1=min(range(l%2019,r%2019))
    if r%2019 == num1:
        print(num1*min(range(l%2019,r%2019-1))%2019)
    else:
        print(num1*(num1+1)%2019)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
x,y = ips()

x%=2019
y%=2019
if x>y:
    y+=2019
m = rem
for i in range(x,y):
    for k in range(i+1,y+1):
        m = min(m,(i*k)%2019)
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(solve())

Submission status: Wrong Answer

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

L = L % mod
R = R % mod
if L >= R:
    print(0)
else:
    ans = float('inf')
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min(ans, (i * j) % mod)
    print(ans)

Submission status: Wrong Answer

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

v = 2019

mini = ((L // v) + 1) * v
if mini > R:
    print((L * (L + 1) ) % v)
    exit()

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

print(mini * (mini +1) % v)

Submission status: Wrong Answer

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

L = L % 2019
R = R % 2019
if R <= L:
	R += 2019

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:
mod = 2019
L,R = [int(x) for x in input().split()]
if(R-L>=2018):
    print(0)
else:
    l = L%mod
    r = R%mod
    if(r<l):
        print(0)
    else:
        print((l*(l+1))%mod)

Submission status: Wrong Answer

Solution code:
l, r = list(map(int, input().split()))
ans = 2*10**9
for i in range(l+1, r+1):
  if ans > (l*i)%2019:
    ans = (l*i)%2019
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = 2019
min_value = 10*10
for i in range(l,r):
    for j in range(i+1,r+1):
        value = i*j%mod
        if value < min_value:
            min_value = value
print(min_value)

Submission status: Wrong Answer

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

mod = 2019
lr = L * (L+1)

ans = lr % mod
print(ans)

Submission status: Wrong Answer

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

import sys

input = sys.stdin.readline

def main():
    L, R = map(int, input().split())
    m = 10000000000
    l = L % 2019
    r = R % 2019
    for i in range(l, r):
        for j in range(i+1, r+1):
            if i == j:
                continue
            m = min(m, i*j % 2019)
    print(m)

main()

Submission status: Wrong Answer

Solution code:
def prob_c():
    l, r = [int(a) % 2019 for a in input().split()]
    if r - l >= 2018:
        print("0")
    else:
        ans = 2018
        for i in range(l, r):
            for j in range(i+1, r+1):
                candidate = (i * j) % 2019
                if ans > candidate:
                    ans = candidate
            if ans == 0:
                break
        print(str(ans))

prob_c()

Submission status: Wrong Answer

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

diff = (R - L)//2019 
l = L%2019
r = R%2019

if l > r or diff >= 1:
    print(0)
else:
    print(l*(l+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
minB = l*(l+1)
maxB = r*(r-1)

minM = minB%2019
maxM = maxB%2019
if minM <= maxM:
    print(minM)
else:
    print(0)

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

x = [i % 2019 for i in range(l, r+1)]
x.sort()

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

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:
def solve():
  l,r = (int(i) for i in input().split())
  mod = 2019
  l %= mod
  r %= mod
  ans = 10**15
  if l >= r:
    print(0)
    exit()
  else:
    for i in range(l,r):
      for j in range(l+1,r+1):
        ans = min(ans,i*j)
  print(ans%mod)

solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(min(mod_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc133/tasks/abc133_c

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def main():
    l, r = map(int, input().split())
    ans = 10**10

    for k in range(l, min(r + 1, l + 2020)):
        ans = min(ans, k * (k + 1) % 2019)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

########

L, R = l_inpl()
L %= 2019
R %= 2019

if R<L:
    R += 2019

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

print(ans)

Submission status: Wrong Answer

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

Lm = L%2019
Rm = R%2019

if Lm*Rm == 0 or R-L > 2017 or Rm < Lm:
    print(0)
    exit()

if R == L+1:
    print(Lm*Rm)
else:
    print(Lm*(Lm+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 2019
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    #愚直
    L,R = MI()
    ans = inf
    if R-L >= 2019:
        print(0)
    else:
        for i in range(L,R+1):
            for j in range(i+1, R+1):
                ans = min(ans,(i*j)%mod)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def solve():
  l,r = (int(i) for i in input().split())
  mod = 2019
  l %= mod
  r %= mod
  ans = 10**15
  if l >= r:
    print(0)
    exit()
  else:
    for i in range(l,r):
      for j in range(l+1,r+1):
        ans = min(ans,i*j)
  print(ans)

solve()

Submission status: Wrong Answer

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

list_ = []
c = 0

while c < 2019:
    if c > r - l:
        break
    list_.append((l+c) % 2019)
    c += 1

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

Submission status: Wrong Answer

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

lm = l % mod
rm = r % mod

if lm >= rm:
    print(0)
else:
    print(lm * (lm + 1))

Submission status: Wrong Answer

Solution code:
#!venv/bin/python
#from collections import defaultdict 
from itertools import combinations
import math
import datetime
L, R = [int(x) for x in input().split()]
MOD = 2019

l = L
r = min(l + MOD, R)

ans = MOD
for i in range(l, r + 1):
    for j in (i + 1, r + 1):
        mod = (i * j) % MOD
        if mod < ans:
            ans = mod
print(ans)

Submission status: Wrong Answer

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

if b-a+1>=mod:
    print(0)
else:
    l=sorted([i%mod for i in range(a,b+1)])
    print(l[0]*l[1])

Submission status: Wrong Answer

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

L = L % 2019
R = R % 2019

min_ = 2019
if L > R:
    R += 2019
for i in range(L, R):
    for j in range(i + 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())
print((l * (l+1)) % 2019)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#ABC133 C

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
def LI(): return list(map(int,sys.stdin.readline().split()))
def LIR(n): return [LI() for _ in range(n)]
mod = 2019

l,r = LI()
mi = float('inf')
if r - l >= 2019:
    for i in range(l,l+2019):
        mi = min(i % mod,mi)
    print(mi**2)
else:
    for i in range(l,r):
        mi = min(i % mod,mi)
    print(mi*(mi+1))

Submission status: Wrong Answer

Solution code:


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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

MOD = 2019  # type: int

def solve(L: int, R: int):
    L = L % 2019
    R = R % 2019
    if L >= R:
        print(0)
        return
    res = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            res = min(res, (i*j)%2019)
    print(res)
    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:
l, r = list(map(int, input().split()))
print(l*(l+1)%2019)

Submission status: Wrong Answer

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

ub = R
lb = L
MOD = 2019

ans = 10 ** 9 + 7
while ub - lb >= 1:
    mid = (ub + lb) // 2
    cnt = ub * lb % MOD
    if ans > cnt:
        ub = mid
        ans = cnt
    else:
        lb = mid
        
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = float('inf')
for i in range(L, L + 2020):
    for j in range(L + 1, L + 2020):
        if (i > R) or (j > R):
            continue
        ans = min(ans, (i * j) % MOD)

print(ans if ans != float('inf') else 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
flg = 1
for i in range(1,10**6+1) :
    
    if L <= 2019*i <= R :
        
        ans = 0
        flg = 0
        break
    
    if 2019*i > R :
        break
if flg :
    L %= 2019
    ans = L*(L+1)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

MOD = 2019

def main():
    L, R = i2nn()
    LM = L % MOD
    RM = R % MOD
    LM2 = min(LM, RM)
    RM2 = max(LM, RM)
    n = int(1e+9)
    for i in range(LM2, RM2):
        for j in range(i+1, RM2+1):
            t = (i * j) % MOD
            if n > t:
                n = t
    print(n)

main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

MOD = 2019  # type: int

def solve(L: int, R: int):
    mn = 2018
    for i in range(L, min(L + 2019, R + 1)):
        mn = min(mn, i % MOD)
    if mn == 0:
        ret = 0
    else:
        ret = (L % MOD) * ((L + 1) % MOD)
    print(ret)
    return


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:
L, R = map(int, input().split())

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

l = L % 2019
r = R % 2019

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

print(minval)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())  # 複数数値入力
li = list()
ans = 2019
for i in range(l, r + 1):
    li.append(i % 2019)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
import numpy as np
if r-l+1 >= 2019:
  print(0)
else:
  k = sorted(np.mod(np.array([i for i in range(l,r+1)]),2019))
  print(k[0] * k[1])

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
a = []
for i in range(L,min(R,L+2019*3)+1):
    a.append(i%2019)
ans = 10**10
for i in range(len(a)):
    for j in range(len(a)):
        if i==j:
            continue
        ans=min(ans,a[i]*a[j])
print(ans%2019)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque
from itertools import accumulate
import sys
sys.setrecursionlimit(10**6)

mo=10**9+7
#n=int(input())
l,r=map(int,input().split())
r=min(l+2019+10,r)

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


print(ans)

Submission status: Wrong Answer

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

from collections import defaultdict

d = defaultdict(int)

for i in range(L,R+1):
  d[i%2019] += 1
  if d[0]>2:
    break

cnt = 0
ans = list()
for k,v in sorted(d.items()):
  _v = v
  
  while _v > 0:
    cnt +=1
    ans += [k]
    _v -= 1
    if cnt >=2:
      print(ans[0]*ans[1])
      quit()

Submission status: Wrong Answer

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

L = L % 2019
R = R % 2019

min_ = 2019
if L > R:
    R += 2019
for i in range(L, 2019):
    for j in range(i + 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())

Lmod = L%2019
Rmod = R%2019

i = Lmod
j = i + 1

print((i*j)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if L % MOD == 0 or L + (MOD - L % MOD) <= R:
  print(0)
  exit()

ans = MOD

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A=list(map(int,input().split()))
t=True
sum=2019
if t:
    for i in range(int(A[1])):
        if i>=A[0]:
            for t in range (int(A[1])+1):
                if t>i:
                    if i*t%2019<=sum:
                        sum=i*t%2019
                        print(i,t)
print(sum)

Submission status: Wrong Answer

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