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

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    l, r = map(int, input().split())
    rg = range(l, r+1)

    if l == 2019:
        print(1)
    elif r == 2019:
        print(l)
    elif r < 2019:
        print(l * (l+1))
    elif 2019 < l:
        print(l * (l+1) % 2019)
    else:
        print(min(l, r % 2019))

Submission status: Wrong Answer

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

if L <= 2019 and 2019 <= R:
    ans = 0

else:
    ans = R * (R + 1)
    for i in range(R - L):
        tmp = ((L + i)*(L + i + 1)) % 2019
        if tmp < ans:
            ans = tmp
            
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
l = s.split()
L = int(l[0])
R = int(l[1])

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

Submission status: Wrong Answer

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

if ml >= mr:
  print(0)
elif R - L >= 2019:
  print(0)
else:
  temp = 2 * 10 ** 9 + 1
  for i in range(ml, mr + 1):
    for j in range(ml + 1, mr + 1):
      temp = min(temp, (i * j) % mod)
  print(temp)

Submission status: Wrong Answer

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

#if R - L >= 2050:
#    print(0)
#else:
ans = 2000
for i in range(L, R):
    for j in range(i+1, R+1):
        x = (i * j) % 2019
        if ans > x:
            ans = x
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().strip().split(' '))
if (R-L+1) >= 2019 or 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())
mod = 2019
if l>=mod and not r < mod*2:
    print(0)
else:
    print(l*(l+1)%mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
parents = list(map(int,input().split(' ')))

a = parents[0] % 2019
if (2019-a)<=1010:
    a = (2019-a)
b = parents[1] % 2019
if (2019-b)<=1010:
    b = (2019-b)
diff = parents[1]-parents[0]
if (parents[0]%2019 + diff) >= 2019:
    print(0)
if a==b:
    res = a*a % 2019
    if (2019-res)<=1010:
         res = (2019-res)
    print(res)
elif a<b:
    res = a*(a+1) % 2019
    if (2019-res)<=1010:
         res = (2019-res)
    print(res)
else:
    res = b*(b+1) % 2019
    if abs(2019-res)<=1010:
        res = abs(2019-res)
    print(res)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

L, R = map(int, input().split())
L_mod = L % 2019
R_mod = R % 2019
min_mod = pow(2018,2)
num = 0

if L_mod < R_mod:
    for i in range(L_mod, R_mod):
        for j in range(L_mod + 1, R_mod + 1):
            num = (i * j) % 2019
            if min_mod > num:
                min_mod = num
elif L_mod > R_mod:
    for i in range(R_mod, L_mod):
        for j in range(R_mod + 1, L_mod + 1):
            num = (i * j) % 2019
            if min_mod > num:
                min_mod = num
else:
    min_mod = L_mod * R_mod
print(min_mod)

Submission status: Wrong Answer

Solution code:
# C - Remainder Minimization 2019

def remind2019(L, R):
    # 0 2019の倍数がある
    if (R-L)>= 2019:
        return 0

    if (R%2019 == 0) or (L%2019==0):
        return 0
    else:
        qL, mL = divmod(L,2019)
        qR, mR = divmod(R, 2019)
        return (mL*(mL+1))

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

Submission status: Wrong Answer

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


while l // 2019 > 0 and r // 2019 > 0:
  l = l % 2019
  r = r % 2019

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

Submission status: Wrong Answer

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

if (r-l)>=2019:
    print("0")
else:
    if (l % 2019) < (r % 2019):
        ans=((l % 2019) * (l+1 % 2019)) % 2019
        print(int(ans))
    elif (r % 2019) == 0:
        ans=((l % 2019) * (l+1 % 2019)) % 2019
        print(int(ans))
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import math
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
#n = int(input())

# スペース区切りの整数の入力
#a = [int(x) for x in input().split()]
l, r = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
#p, q, r = map(int, input().split())
#s = [int(x) for x in input().split()]
#t = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re
import fractions

def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)
  
def count(c):
  r = b // c - (a - 1) // c;
  print(c, r, file=sys.stderr)
  return r

print(l, r, file=sys.stderr)
l = l % 2019
#r = r % 2019
#if r < l:
#  r += 2019
#  if r < l:
#    r = r2
print(l, r, file=sys.stderr)

def doit():
  res = 2019
  for x in range(l, r):
    for y in range(l + 1, r + 1):
      #print(x, y, file=sys.stderr)
      res = min(res, (x * y) % 2019)
      if res == 0:
        return 0
  return res % 2019

#print(doit([0] * 4))
#doit(s)
#print(doit())
try:
  print(doit())
except Exception as e:
  print("e", e, file=sys.stderr)

Submission status: Wrong Answer

Solution code:
import sys
L, R = map(int, input().split())
    
if R - L + (L % 2019) >= 2019:
    print(0)
    sys.exit()
else:
    ans = [0] * (2019 - L % 2019)
    i = 0
    while L % 2019 != 0:
        ans[i] = L % 2019
        i += 1
        L += 1
ans = sorted(ans)
print(ans[0] * ans[1])

Submission status: Wrong Answer

Solution code:
from sys import stdin

if __name__ == '__main__':

    L, R = [int(x) for x in stdin.readline().rstrip().split()]

    mods = list()
    for i in range(R - L + 1):
        mods.append((R - i) % 2019)

    mods.sort()

    # 剰余の分配則
    print(str((mods[0] * mods[1]) % 2019))

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
dif=R-L
if(dif>2019*2):
    dif=2019*2
l=L%2019
arr=[]
while(dif):
    arr.append(l)
    l+=1
    if(l==2019):
        l=0
    dif-=1
arr.sort()
if(len(arr)==1):
    arr.append(l)
print((arr[0]*arr[1])%2019)

Submission status: Wrong Answer

Solution code:
L,R = (int(i) for i in input().split())

minimum = 2019

for i in range(L, R):
    for j in range(i+1, R):
        v = (i * j) % 2019
        minimum = min([v, minimum])

print(minimum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L2, R2 = L % Y, R % Y
dist = (R - L) // Y

if L2 == 0 or R2 == 0 or R2 <= L2 or 1 <= dist:
    res = 0
elif Y < L:
    res = L2 * (L2+1)
else:
    res = L2 * R2

print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
 
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    L, R = list(map(int,input().split()))
    m=2020
    for i in range(L,R):
        t=(i*(i+1))%2019
        # print(t)
        if t<m:
            m=t
    if R%2019==0:
        print(0)
    else:
        print(m)
    # print(A,B)
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s, e = map(int, input().split())
mn = min(list(map(lambda x:x%2019, range(s,e+1))))
ans = 1000000007
for i in range(mn+1, e+1):
    ans = min(ans, mn*i)
print(ans)

Submission status: Wrong Answer

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

if R-L >= 2019:
    print(0)
else:
    flg = True
    for k in range(L,R+1):
        mod = k%2019
        if mod == 0:
            print(0)
            flg = False
            break
    if flg:
        print((L*(L+1))%2019)

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

    if l > r:
        l, r = r, l

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

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
mod = 2019
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod
L,R = map(int,input().split())
LL = L % 2019
RR = R % 2019
if (R//2019) == (L//2019):
    g = 9999999999999
    for i in range(L,R+1):
        for j in range(L,R+1):
            if i<j:
                g = min(g,mul(i,j))
    print(g)
elif (R//2019)-(L//2019) == 1:
    g = 9999999999999
    for i in range(L,R+1):
        for j in range(L,R+1):
            if i<j:
                g = min(g,mul(i,j))
else:
    RR = 2018
    g = 99999999999999999
    for i in range(LL,RR+1):
        for j in range(LL,RR+1):
            if i < j:
                g = min(g,mul(i,j))
    print(g)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
hoge = input().split()
L = int(hoge[0])
R = int(hoge[1])
ans = None
if (R - L) > 2019:
  for i in range(L,R+1):
    print(i)
    if i % 2019 == 0:
      ans = i
      break
min_ = 2019
if ans is None:
  for i in range(L,R+1):
    if i % 2019 < min_:
      min_ = i % 2019
L = min_
  
if ans is not None:
  print(1)
else:
  print((L*(L+1)) % 2019)

Submission status: Wrong Answer

Solution code:
n1,n2 = map(int,input().split())

n1mod = n1 % 2019
n2mod = n2 % 2019

a = (n1mod * n2mod) % 2019

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = r % mod
line = x * mod

if l < line < r:
    print(0)

else:
    y = l % 2019
    print((y*(y+1))%mod)

Submission status: Wrong Answer

Solution code:
str = input()

L, R = map(int, str.split(" "))

min = 2019

L = L % 2019
R = R % 2019
if L > R:
    t = L
    L = R
    R = t

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

print(min)

Submission status: Wrong Answer

Solution code:
l,r = (int(i) for i in input().split())
la=l%2019
ra=l%2019
if la > ra:
  la,ra=ra,la
  
minval=2018

for i in range(la,ra+1):
  if i < minval:
    minval=i
    
print(minval*(minval+1)%2019)

Submission status: Wrong Answer

Solution code:
a = input().split()
a = [int(i) for i in a]
if (a[0] < 2019 and a[1] >= 2019) or (a[0] <= 2019 and a[1] >= 2019):
    print(0)
else:
    yojyou_list = []

    if a[0] > a[1]:
        for i in range(a[0] - a[1] + 1):
            yojyou_list.append((a[1] + i) % 2019)
    else:
        for i in range(a[1] - a[0] + 1):
            yojyou_list.append((a[0] + i) % 2019)

    yojyou_list = sorted(yojyou_list)

    if yojyou_list[0] * yojyou_list[1] >= 2019:
        print((yojyou_list[0] * yojyou_list[1]) % 2019)
    else:
        print(yojyou_list[0] * yojyou_list[1])

Submission status: Wrong Answer

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

lis = []
if r - l > 9999:
    r = l + 5000
for i in range(l, r+1):
    lis += [i % 2019]
lis.sort()

if lis[0] == 0 and lis[1] != 0:
    print(lis[1] * lis[2])
else:
    print(lis[0] * lis[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy

L, R = map(lambda x: int(x) % 2019, input().split())

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
num = input().split()
l, r = int(num[0]), int(num[1])
ans = 0
if l==0:
  ans = 0
elif r-l+1>=2019:
  ans = 0
else:
  if l+(2019-l%2019) > r:
    ans = l%2019*(l+1)%2019
  else:
    ans = 0
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if r-l>=2018:
  print(0)
else:
  m=2019
  l=l%m;r=r%m
  if r>l:
    print((l**2+l)%m)
  else:
    print(0)

Submission status: Wrong Answer

Solution code:
MOD = 2019

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

minmod1 = 2019
minmod2 = 2020
for i in range(l, r + 1):
    if i % MOD < minmod2:
        minmod2 = i % MOD
        if minmod2 < minmod1:
            temp = minmod1
            minmod1 = minmod2
            minmod2 = temp

ans = (minmod1 * minmod2) % 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

    if l > r:
        l, r = r, l

    for i in range(l, r):
        for j in range(i+1, r+1):
            m = min(m, i*j)
    print(m)

main()

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) % 2019)

Submission status: Wrong Answer

Solution code:
inf = float('inf')

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

if R - L >= 2018:
    print(0)
else:
    m1, m2 = inf, inf
    for i in range(L, R + 1):
        if i % 2019 < m1:
            m2 = m1
            m1 = i % 2019
        elif i % 2019 < m2:
            m2 = i % 2019
    print(m1 * m2 % 2019)

Submission status: Wrong Answer

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

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

#print(L%2019, R%2019)

#print((L + 2019 - L%2019))

tmp = 0

if (L + 2019 - L%2019) + 1 <= R:
	i =  L + 2019 - L % 2019
	j = i+1

else:
	i = L
	j = i+1
'''
if L < R:
	i = L
	j = L+1

	if tmp > i*j:
		tmp = i * j % 2019

'''

ans = i * j % 2019

print(ans)

Submission status: Wrong Answer

Solution code:
import math
def solve():
    l, r = map(int, input().split())
    l_div = l // 2019
    r_div = r // 2019
    if(l_div != r_div):
        print(0)
    else:
        k = (l * (l+1)) % 2019
        print(k)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

D = R - L
Ans = {2018}
J_Set = {2018}
def cal(a, b):
    return int((a*b)%2019)

for i in range(min(D, 2019)):
    for j in range(D-i):
        J_Set.add((L+i+j+1)%2019)
        if j > 2019:
            break
    Ans.add(cal(L+i, min(J_Set)))

print(min(Ans))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = 2018

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

if L > R:
    R += 2019
    
else:
    for i in np.arange(L, R+1):
        for j in np.arange(i+1, R+1):
            i = i % 2019
            j = j % 2019
            k = i * j % 2019
            ans = np.amin(np.array([k, ans]))
    print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
MOD = 2019
mL = L%MOD
mR = R%MOD
if mL>=mR:
    mR +=MOD
min_mod = MOD
#print(mL, mR)
for i in range(mL, mR):
    for j in range(i+1, mR+1):
        min_mod=min(i*j%MOD, min_mod)
        #print(i, j)
print(min_mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
I = L % 2019
if (R - L + 1) >= 100000:
    print(0)
    exit()
else:
    imax = R - L + 1

for i in range(imax - 1 ):
    ans.append(((L + i)*(L + i + 1))%2019)

print(min(ans))

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
L_mod = L%mod
R_mod = R%mod
sa = R-L
if sa >= mod*2:
    ans = 1
elif sa >= mod:
    ans = 1
else:
    ans = mod
    for i in range(L,R):
        for j in range(i+1,R+1):
            x = i%mod * j%mod
            ans = min(ans,x%mod)
        
    
print(ans)

Submission status: Wrong Answer

Solution code:
N,M=list(map(int,input().split()))
if M-N>2019 or (N%2019>M%2019):
    print(0)
else:
    print(N*(N+1)%2019)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
c = 1
cmin = 2018

for i in range(a,b+1):
  c = i % 2019
  if c == 0:
    cmin = 0
    break
    
    #iが決定
  if cmin > c:
    cmin = c
    
d = cmin +1
if d >2018:
  d=0
    
print((cmin*d) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
L, R = map(int, input().split())
if R - L >= 2018 :
    print(0)
    sys.exit()
LM = L % 2019
RM = R % 2019
if RM < LM :
    print(0)
else :
    print((LM * (LM+1)) % 2019)

Submission status: Wrong Answer

Solution code:
in_ = [int(i) for i in input().split()]
L = in_[0]
R = in_[1]
mod_min = 100000
L = L % 2019
R = R % 2019
for i in range(L, R):
    for j in range(i+1, R+1):
        if i * j < 2019:
            mod = ((i%2019) * (j%2019)) % 2019 
            if mod < mod_min:
                mod_min = mod
            # continue
        

        
            

print(mod_min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


while l // 2019 != 0 or r // 2019 != 0:
  l = l % 2019
  r = r % 2019
  
mini = 1e+10
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mini = min(mini, (i*j) % 2019)
print(mini)

Submission status: Wrong Answer

Solution code:
def main():
    L, R = map(int, input().split())
    ans = float('INF')
    for i in range(L, R):
        ans = min(ans, (i * (i + 1)) % 2019)
        if ans == 0:
            break
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
b=L%2019
d=R%2019
if b>d:
  d=d+2019
f=(b*d)%2019
for i in range(b,d-1):
  for j in range(i+1,d):
    e=(i*j)%2019
    if e<f:
      f=e
    j=j+1
  i=i+1
print(f)

Submission status: Wrong Answer

Solution code:
L, R = (int(i) for i in input().split())
i, j = 2018, 2018
imod, jmod = 2018, 2018
if R < 2019:
    i = L
    j = L+1
    imod = i
    jmod = j
elif L <= 2019:
    print(0)
    exit()
else:
    for k in range(L, R+1):
        m = k%2019
        if imod > m or jmod > m:
            if imod < jmod:
                j = k
                jmod = m
            else:
                i = k
                imod = m

#print(i, j)
#print((i*j)%2019)
print(imod*jmod)

Submission status: Wrong Answer

Solution code:
def main():
    l,r = map(int,input().split(' '))
    tmp = 2019
    res = 0
    if r-l >= 2018:
        print(0)
    else:
        for i in range(l,r+1):
            if tmp > i%2019:
                tmp = i%2019
                res = i
        if res != r:
            print((res*(res+1))%2019)
        else:
            print(0)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
L, R = list(map(int, str(input()).split()))

L_mod = L % 2019
R_mod = R % 2019

if L_mod >= R_mod:
    print(str(R_mod * (R_mod + 1)))
else:
    print(str(L_mod * (L_mod + 1)))

Submission status: Wrong Answer

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

if R - L >= 2019:
  print(0)
else:
  N = [x % 2019 for x in range(L, R+1)]
  i = N.index(min(N))
  n = N[i]
  N.pop(i)
  j = N.index(min(N))
  print(((n % 2019) * N[j]) % 2019)

Submission status: Wrong Answer

Solution code:
def main():
    L, R = list(map(int, input().split()))
    if L <= 2019 <= R:
        print(0)
        exit()

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

    if R < 2019:
        print(R * (R - 1) % 2019)
    elif 2019 < L:
        print(L * (L + 1) % 2019)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

for i in range((a[1]-a[0]+1)%2019):
  for j in range(i):
    c = ((a[0]+i)%2019)*((a[0]+j)%2019)
    b.append(c)
else:
  print(min(b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:



if __name__ == "__main__":
    n, a = map(int, input().split())

    if n < 2019 and a < 2019:
        print(n * a % 2019)

    elif 2019 < n and 2019 < a:
        print(n * n+1 % 2019)

    elif n < 2019 and 2019 <= a:
        print(0)

    elif n <= 2019:
        print(0)

Submission status: Wrong Answer

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

a = 2020

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

print(a)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if R-L >= 2019:
    print('0')
else:
    for i in range(L, R):
        if i % 2019 < mini:
            mini = i % 2019
    
    calc = (mini * (mini+1)) % 2019
    print(calc)

Submission status: Wrong Answer

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

s = l % mod
e = r % mod

for i in range(s,e):
    for j in range(i+1,e+1):
        m = ((i % mod) * (j % mod)) % mod
        #m = (i * j) % mod
        #print(i,j,m)

        if m < mod_min:
            mod_min = m

print(mod_min)

Submission status: Wrong Answer

Solution code:
from random import randint

def solve0(L, R):
    m = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            t = (i*j) % 2019
            if t < m:
                m = t
                I = i
                J = j
    return I, J, m

def solve(L, R):
    M = 2019
    I = L
    mi = []
    mj = []
    for i in range(L, R+1):
        m = i % 2019 
        if m == 0:
            return 0, 0, 0
        mi.append(i)
        I = i

    for i in range(I+1, R+1):
        m = i % 2019 
        if m == 0:
            return 0, 0, 0
        mj.append(i)
    print(mi)
    m = 2019
    for a in range(0, len(mi)):
        i = mi[a]
        for b in range(a+1, len(mi)):
            j = mi[b]
            t = (i*j)%2019 
            #print(i, j, t)
            if t < m:
                I = i
                J = j
                m = t

    return I, J, m

if 1==0:
    N = 10000
    while True:
        l = randint(0, N)
        r = randint(l+1, N)
        if solve(l,r) != solve0(l,r):
            print("bad", l, r)
            break


def main():
    L, R =[int(x) for x in input().split()]
    answer = solve(L, R)
    #print("solve0", solve0(L, R))
    #print("solve ", answer)
    print(answer[-1])

main()

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

def main():
    N = R - L + 1
    m = L // 2019
    if N >= 2019:
        ans = 0
    elif R // 2019 >= m + 1:
        ans = 0
    else:
        ansLi = L % 2019
        ansLj = (L+1) % 2019
        ansL = ansLi * ansLj

        ansRi = R % 2019
        ansRj = (R-1) % 2019
        ansR = ansRi * ansRj

        ans = min(ansL, ansR)

    return int(ans)

print(main())

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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



def solve():
  MOD = 2019
  L,R = map(int, input().split())
  ij = [2*10**9,2*10**9]
  for i in range(L,R+1):
    if min(ij)==0:
      return 0
    else:
      ij = [min(ij),min([max(ij),i%MOD])]
  return (ij[0]*ij[1])%MOD


def main():
  print(solve())


if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

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

if( R - L >= 3000):
    print(0)
    sys.exit()

r = np.array(list(i for i in range(L, R+1)))

r = np.sort(np.mod(r, 2019))

# print(r)
print(np.mod(r[0] * r[1], 2019))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
l, r = map(int, input().split())

# prime_factor = 3, 673
mod = 2019

min_div = mod
last_div = l % mod
for i in range(l + 1, r + 1):
    div = i % mod
    min_div = min(min_div, (last_div * div) % mod)
    last_div = div

    if min_div == 0:
        break
print(min_div)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

l,r = list(map(int,input().split()))
f = [0]*2020
ans = 2020
for i in range(l,r):
    if f[i%2019] == 0:
        ans = min((i*(i+1))%2019,ans)
        f[i%2019] =1
    else:
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

min = 0
max = 0
ans = 0

tempL = int(L / 2019)
tempR = int(R / 2019)

if(tempL != tempR):
    ans = 0
else:
    if L % 2019 <R % 2019:
        min = L
        max = L + 1
    else:
        min = R - 1
        max = R
    ans = ((min % 2019) * (max % 2019)) % 2019

print(ans)

Submission status: Wrong Answer

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

    flag=True
    for i in range(L,R+1):
        if i%2019 ==0:
            print(0)
            flag=False
            break
    if flag:
        print(L*(L+1)%2019)


if __name__=="__main__":
    main()

Submission status: Wrong Answer

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


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    L, R = read_h()
    l, r = L % 2019, R % 2019

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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