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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
g = 2019
ans = 0

cl = L // g
cr = R // g
if cl == cr:
    ans = (L * (L+1))%g

print(ans)

Submission status: Wrong Answer

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

min1 = 10000
border = 4038
ancker = 99999

for i in range(L, min(R+1, L + border)) :
    if i % 2019 < min1 :
        min1 = i % 2019
        ancker = i

min2 = 100000

for i in range(L, min(R+1, L + border)) :
    if i % 2019 < min2 and i != ancker:
        min2 = i % 2019

print(min1 * min2)

Submission status: Wrong Answer

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

ans = 10 ** 7

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

print(ans)

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

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

base = 2019
temp = L
mod = []
while (temp <= R) and (temp-L < base):
    mod.append(temp % base)
    temp += 1

mod.sort()
print((mod[0] * mod[1]) % base)

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)%mod)
    else:
        print(0)

Submission status: Wrong Answer

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

# prime_factor = 3, 673
mod = 2019

num673 = r // 673 - l // 673
if num673 > 0 and r - l > 2:
    print(0)
    sys.exit()


div_set = set()
min_div = 2019

for i in range(l, r + 1):
    div = i % 2019
    div_set.add(div)
    min_div = min(min_div, div)

    if min_div == 0:
        break

if min_div == 0:
    print(0)
else:
    cnt = 0
    ans = 1
    for val in div_set:
        cnt += 1
        ans *= val
        if cnt == 2:
            break
    print(ans % 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 >= 2 and R // 673 > (L-1) // 673:
        return 0

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

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


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

Submission status: Wrong Answer

Solution code:
import itertools as it
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
print(l, r)
result = 2020
if l < r:
    for x, y in it.combinations([i for i in range(l, r + 1)], 2):
        temp = (x * y) % 2019
        if temp < result:
            result = temp
        if result == 0:
            break
elif l > r:
    for x, y in it.combinations([i for i in range(0, r + 1)] + [i for i in range(r, 2019)], 2):
        temp = (x * y) % 2019
        if temp < result:
            result = temp
        if result == 0:
            break
else:
    result = 0
print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import itertools

L, R = (int(i) for i in input().split()) 
if R - L >= 2019: 
  print(0)
else:
  ans = 2019
  for x, y in itertools.combinations(range(L, R + 1), 2):
      ans = min((x % 2019) * (y % 2019), ans)
  print(ans)

Submission status: Wrong Answer

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

a = []
if l0 <= r0:
    a = list(range(l0, r0+1))
else:
    a = list(range(0, l0+1)) + list(range(r0, mod))

m = 10000
for i in range(len(a)-1):
    for j in range(i+1, len(a)):
        x = (a[i] * a[j]) % mod
        if x < m:
            m = x
print(m)

Submission status: Wrong Answer

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

import numpy as np

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

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

Submission status: Wrong Answer

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

LR = input().split(' ')
L = int(LR[0])
R = int(LR[1])

L2 = L % 2019
R2 = R % 2019
if L2 > R2:
    R2 += 2019

r = sorted(map(lambda x: x % 2019, range(L2, R2 + 1)))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split(' '))
l = []
for i in range(L,R+1):
    l.append(i % 2019)
l_s = sorted(l)
print('{}'.format(l_s[0] * l_s[1]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

diff = r - l
diff = min(diff,2019)

ans = 2019

for i in range(l+1,l+diff+1):
    ans = min(ans,(l * i)%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

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

if L == 0:
    print(0)
    sys.exit()

temp = R // t
temp2 = L // t
kouho = []
if temp != temp2:
    print(0)
    sys.exit()
else:
    for i in range(L, R+1):
        kouho.append(i % t)
    kouho.sort()
    ans = (kouho[0] * kouho[1]) % t
    print(ans)

Submission status: Wrong Answer

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

length = min(2019, R-L)

m = (L % 2019) * (R % 2019)
for i in range(L, L+length) :
    for k in range(i+1,L+length) :
        # tmp = (i*k) % 2019

        l = i % 2019
        r = k % 2019
        tmp = (l*r) % 2019
        if (tmp < m) :
            m = tmp 

print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
from itertools import combinations
print(673*3)
def solve():
    L, R = map(int, input().split())
    l, r = L%2019, R%2019
    if R-L >= 2019-1 or l >= r or l == 0:
        return '0'
    elif R-L >= 673-1 or ((R-L >= 3-1 or L%3 >= R%3 or L%3 == 0) and L%673 >= R%673) or ((R-L >= 3-1 or L%3 >= R%3 or L%3 == 0) and L%673 == 0):
        return '0'
    elif R-L == 1:
        return str((L*R)%2019)
    else:
        return str(min((i*j)%2019 for i, j in combinations(range(L,R+1),r=2)))

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
input = [int(x) for x in stdin.readline().rstrip().split()]

L=input[0]
R=input[1]


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




print(output)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
l, r = map(int, input().split())
l %= 2019
r %= 2019
if l > r:
    print(0)
else:
    print(min(l * (l + 1), (r - 1) * r % 2019))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
i=0
s=[]
if (r-l)>2019:
    print(0)
else:
    while i!=(r-l)+1:
        s.append(((l+i)%2019))
        i+=1
    s.sort()
    print(s[0]*s[1])

Submission status: Wrong Answer

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

l = l % mod
r = r % mod

x = min(l,r)
print(x*(x+1))

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())  # 複数数値入力

lm = l % 2019
rm = r % 2019

if (r - l) + lm < 2019:  # 間に2019の倍数はない
    print((min(lm, rm) * (min(lm, rm) + 1)) % 2019)
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())

min_mod = 2*10**9
for i in range(l, r):
    #for j in range(i+1, r+1):
    mod = i*(i+1) % 2019
    if mod < min_mod:
        min_mod = mod

print(min_mod)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
start = L % 2019
end = R % 2019
dist = abs(end - start)

if dist == 1:
    print((start * end) % 2019)
    exit()


ra = 3000
for i in range(dist):
    for j in range(1, dist-1):
        r = (i + start) * (j + start)
        print(r)
        if ra > r :
            ra = r

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(i+1, mr):
            #if (i*j) % 2019 == 0:
            #    print(i,j,i*j,(i*j)%2019)
            mi = min(mi, (i*j) % 2019)
    print(mi)

Submission status: Wrong Answer

Solution code:
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
L,R = map(int, input().split())		# 5 7 2

mod=2019

l = L % mod
r = R % mod

while l>r:
	r+=mod

ans=mod
for a in range(l,r):
	for b in range(a+1, r+1):
		ans = min(ans, (a*b)%mod)

#a=l%mod
#b=a+1
#ans=(a*b)%mod

p("l,r,a,b,ans",l,r,a,b,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    l,r = map(int,input().split(' '))
    if r-l >= 2019 or l//2019!=r//2019:
        print(0)
    elif l%2019<r%2019:
        print((l*(l+1))%2019)
    else:
        print((r*(r-1))%2019)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
L=l%2019
R=r%2019
min=2020
if L>R:
    R=R+2019
for j in range(L,R+1):
    for i in range(L,j):
        if min > i*j%2019:
            min = i*j%2019
print("{}".format(min))

Submission status: Wrong Answer

Solution code:

def input_from_console():
    l, r = map(int, input().split())
    return l, r


def solve(l, r):
    first = min(l % 2019, r % 2019)
    result = first * (first + 1)
    return result


def main():
    l, r = input_from_console()
    print(solve(l, r))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def slv(L, R):
    m = []
    M = 2019
    for i in range(L, min(R+1, L+M+1)):
        m.append(i%M)
    m.sort()
    return (m[0] * m[1]) % M

@mt
def slv2(L, R):
    ans = sys.maxsize
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min((i*j)%2019, ans)
    return ans

def main():
    L, R = read_int_n()
    print(slv(L, R))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

num_list = []

for i in range(L, R+1):
    for j in range(i+1, R+1):
        num = i*j
        num_list.append(num - math.floor(num/2019))

print(min(num_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if R-L > 2019:
    print(0)
else:
    i_mod = 2019
    j_mod = 2019
    for k in range(L,R+1):
        mod = k%2019
        if mod < i_mod:
            j_mod = i_mod
            i_mod = mod
        elif mod < j_mod:
            j_mod = mod
    print((i_mod*j_mod)%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())
#if l <= 2019

LL = L % 2019
RR = R % 2019
if L % 2019 > R % 2019:
    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,mul(i,j))
print(g)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

mod_list = []

for i in range(L, R+1):
    mod_list.append(i%2019)

mod_list.sort(reverse=False)


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

Submission status: Wrong Answer

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

div_l = L//2019
div_r = R//2019

ans = 0
if div_l == div_r:
    ans = L%2019 * (L+1)%2019
print(ans)

Submission status: Wrong Answer

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

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,MOD-1)
    # R = min(R,MOD-1)
    L = L % 2019
    R = R % 2019
    if(R <= L):
        R += MOD

    ans = MOD
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans = max(0, 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:
L,R = map(int,input().split())
list1 = []
i = L
j = L + 1
jcount = 0
while True:
    if i < R :
        list1.append(i*j%2019)
        if j <= R:
            j += 1
        else:
            jcount += 1
            j = L + jcount
            i += 1
    else:
        break

if len(list1) == 0:
    print(i*j%2019)

list1.sort
print(list1[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
L_2019 = L%2019
R_2019 = R%2019
ans1 = (L_2019*R_2019)%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())
mod = 2019
ml = L % mod
mr = R % mod

if ml >= mr:
  print(0)
else:
  print(ml * (ml + 1))

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

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    l,r=MAP()
    if l%2019==l and r%2019==r:
        print((l*l+1)%2019)
    elif l%2019!=l and r%2019!=r:
        lis=list(range(l%2019))+list(range(r%2019))
        lis.sort()
        print((lis[0]*lis[1])%2019)
    else:
        print(0)


if  __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():

   in0 = input()

   IN = in0.split(' ')

   L = int(IN[0])
   R = int(IN[1])
   y = 2019

   min_mod = (L*R)%y
   for i in range(L,R):
      for j in range(i+1,R):
          cal = (i*j)%y
          if (min_mod>cal):
              min_mod = cal


   print ("%s" % (min_mod))




if __name__ == "__main__":
   main()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if r < 2019:
    print(l*r)
elif l <= 2019 and 2019 <= r:
    print(0)
else:
    if (r-l) >= 2018:
        print(2)
    else:
        new_l = l % 2019
        new_r = r % 2019
        count_l = l // 2019
        count_r = r // 2019
        if new_r >= 2 and count_l != count_r:
            print(2)
        else:
            print(new_l*(new_l+1))

Submission status: Wrong Answer

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



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

print(solve())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

flag = False
if r // 2019 - l // 2019 != 0:
    flag = True

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

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

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

base = 2019
temp = L
mod = []
while (temp <= R) and (temp-L <= base):
    mod.append(temp % base)
    temp += 1

mod.sort()
print((mod[0] * mod[1]) % base)

Submission status: Wrong Answer

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



def divisors(num):
    """
    約数全列挙
    """
    divisors = []
    for i in range(1, int(num ** 0.5) + 1):
        if num % i == 0:
            divisors.append(i)
            if i != num // i:
                divisors.append(num // i)

    return divisors


mod = 2019
tar = set()
for i in range(1, 10 ** 6):
    tar.add(673 * i)

ans = float("inf")
for t in tar:
    if L <= t <= R:
        if (R - L + 1) >= 3:
            print(0)
            exit()
        else:
            flg = False
            min_num = float("inf")
            for i in range(L, R + 1):
                if i % 3 == 0:
                    flg = True
                if i != t:
                    min_num = min(min_num, i % 3)
            if flg:
                print(0)
                exit()
            else:
                ans = min(ans, min_num)
print(min((L * (L + 1)) % mod, ans))

Submission status: Wrong Answer

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

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

print(ans)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l_2019 = L % 2019
r_2019 = R % 2019

if R - L >= 2019:
    print(0)
else:
    if l_2019 >= r_2019:
        print(0)
    else:
        print((l_2019*(l_2019+1))%2019)

Submission status: Wrong Answer

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

base = 2019
l_mod = l % base
r_mod = r % base

if r - l > 2019:
    print(0)
elif r_mod < l_mod:
    print(0)
else:
    print(l_mod * (l_mod + 1))

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:
            print(0)
            f = False
            break
    if f:
        print(L%2019 * (L+1)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if r-l >= 2019:
    print("0")
else:
    l2r = [e%2019 for e in list(range(l,r+1,1))]
    l2r.sort()
    print(l2r[0] * l2r[1])

Submission status: Wrong Answer

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

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

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()
if 3 in list_ and 673 in list_:
    print(0)
else:
    print(list_[0] * list_[1])

Submission status: Wrong Answer

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

for i in range(1,10**6):
    if i * 2019 >= L and i*2019 <= R:
        print(0)
        exit()

if R < 2019:
    print(R*(R-1)%2019)
    exit()

ansa = -1
a = 10**20
ansb = -1
ans = 10**20
for i in range(1,10**6):
    x = 2019*i - L
    y = R - 2019*i
    if x < 0:
        ans = min(ans , L*(L+1) % 2019)
    elif y < 0:
        ans = min(ans , R*(R-1) % 2019)
    else:
        ans = 0
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from itertools import combinations

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

l = l % 2019
r = r % 2019
if r < l:
  r += 2019

print(min([(i * j) % 2019 for i, j in combinations(range(l, r+1), 2)]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
l,r=map(int,input().split())
flg=0
m=10*9
for i in range(10**6):
    if l<=2019*i<=r:
        flg=1
        m=0

for i in range(l,r): 
    if flg==1:
        break
    for j in range(l+1,r+1):
        if (i*j)%2019<m:
            m=(i*j)%2019

print(m)

Submission status: Wrong Answer

Solution code:
L, R = list(map(int, raw_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):
        min_ = min(min_, i * j % 2019)
print(min_)

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 = L//2019 + 1
	if(2019*m <= R):
		print(0)
	else:
		print((L*(L+1)%2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

diff = r - l
diff = min(diff,2019)

ans = 2019

for i in range(l+1,l+diff):
    ans = min(ans,(l * i)%2019)
print(ans)

Submission status: Wrong Answer

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

l %= 2019
r %= 2019
l = min(l,r)
r = max(l,r)
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 = list(map(int, input().split(" ")))

if L <= 2019 and R >= 2019:
    print(0)
else:
    L = L % 2019
    R = R % 2019
    
    if L >R:
        tmp = R
        R = L
        L = tmp
        
    if L==R:
        print((L*L) % 2019)
    
    else:
        mi = (L*(L+1)) %2019
        for i in range(L, R-1):
            for j in range(i+1, R):
                tmp = (i*j) % 2019
                if tmp < mi:
                    mi = tmp
                    
        print(mi)

Submission status: Wrong Answer

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

if R - L >= 2020:
    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().split())
mod_n = 2019
if mod_n < (R - L + 1):
    print(0)
    exit()

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:
def calc(L, R):
    imod = L % 2019
    if (imod == 0):
        print(0)
    elif (R - L > 2019 - imod - 1):
        print(0)
    else:
        print(imod * (imod + 1))


s = input().split(' ')
L = int(s[0])
R = int(s[1])
calc(L, R)

Submission status: Wrong Answer

Solution code:
L, R = (int(x) for x in input().split())
l, r = L%2019, R%2019
if l >= r or (R-L)//2019 != 0:
    print(0)
else:
    tmp = (l*r)%2019
    for i in range(l, r-1):
        for j in range(i+1, r):
            if (i*j)%2019 < tmp:
                tmp = (i*j)%2019

    print(tmp)

Submission status: Wrong Answer

Solution code:
I, J = map(int, input().split())

a = min([i%2019 for i in range(I, J)])
print(a*(a+1))

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

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

base = 2019
temp = L
mod = []
while (temp <= R) and (temp-L <= base):
    mod.append(temp % base)
    temp += 1

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
d = R - L + 1
c = d // mod 
a = L % mod
b = R % mod
if c >= 2 :
    print(0)
else :
    if a > b :
        print(0)
    else :
        print(a*(a+1)%mod)

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(l, r + 2019):
        for j in range(i+1, r+2019):
            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:
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np


# なんこか入力
l,r = map(int, input().split())

l = r + (l-r) % 2019

answer = 9999
for j in range(l,r+1):
    for i in range(l,j):
        a = i % 2019
        b = j % 2019
        answer = min(answer,(a*b)%2019)

print(answer)