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())
l = L % 2019
r = R % 2019
if R - L >= 673:
  print(0)
elif l > r:
  print(0)
elif l <= 672 and r >= 673:
  print(0)
elif l == 673 and r >= 675:
  print(0)
elif l <= 1344 and r >= 1346:
  print(0)
elif l <= 1346 and r >= 1347:
  print(0)
else:
  print(l * (l + 1) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
import heapq

[l,r]=[int(x) for x in input().split()]

ans=[]
for item in range(l,r+1):
  mod=item%2019
  if mod==0:
    print(0)
    exit()
  else:
    heapq.heappush(ans,mod)

tmpset=set(ans)
flag=1
for item in tmpset:
  if item%3==0:
    flag=flag*2
  if item%673==0:
    flag=flag*3

if flag%6==0:
  print(0)
else:
  print(heapq.heappop(ans)*heapq.heappop(ans))

Submission status: Wrong Answer

Solution code:
import heapq

[l,r]=[int(x) for x in input().split()]

ans=[]
for item in range(l,r+1):
  mod=item%2019
  if mod==0:
    print(0)
    exit()
  else:
    heapq.heappush(ans,mod)

tmp=set(ans)
if (3 in tmp)and(673 in tmp):
  print(0)
else:
  print(heapq.heappop(ans)*heapq.heappop(ans))

Submission status: Wrong Answer

Solution code:
from sys import exit, stderr, stdin
input = stdin.readline
def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    L, R = [int(n) for n in input().split()]
    if (L//2019)<(R//2019):
        print(0)
    else:
        l = L%2019
        r = R%2019
        res = 2019**2
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                res = min(res,i*j)
        print(res)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import heapq

[l,r]=[int(x) for x in input().split()]

ans=[]
for item in range(l,r+1):
  mod=item%2019
  if mod==0:
    print(0)
    exit()
  else:
    heapq.heappush(ans,mod)
print(heapq.heappop(ans)*heapq.heappop(ans))

Submission status: Wrong Answer

Solution code:
from sys import exit, stderr, stdin
input = stdin.readline
def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    L, R = [int(n) for n in input().split()]
    r = L%2019
    # print(r)
    # print((L//2019+1)*2019)
    print((r)*(r+1) if (((L//2019)+1)*2019 > R) else 0)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

for i in range(L, R+1):
    array.append(i % mod)

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

Submission status: Wrong Answer

Solution code:
lis=list(map(int,input().split()))
lis2=sorted([i%2019 for i in range(lis[0],lis[1]+1)])
if (lis2[0]*lis2[1])%2019<(lis2[-1]*lis2[-2])%2019:
  print((lis2[0]*lis2[1])%2019)
else:
  print((lis2[-1]*lis2[-2])%2019)

Submission status: Wrong Answer

Solution code:
import math
import sys
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

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

L_mod = L % 2019

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

min_value = 2018
for i in range(L+1,R+1):
    value = L_mod * (i % 2019)
    value %= 2019
    if value < min_value:
        min_value = value

print(min_value)

Submission status: Wrong Answer

Solution code:
import math
import sys
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

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

L_mod = L % 2019

min_value = 2020
for i in range(L+1,L+1+min(2019,R-L)):
    value = L_mod * i
    value = value % 2019
    if value < min_value:
        min_value = value

print(min_value)

Submission status: Wrong Answer

Solution code:
import math
import sys
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

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

L_mod = L % 2019

min_value = 2020
for i in range(L+1,L+min(2019,R-L+1)):
    value = L_mod * i
    value = value % 2019
    if value < min_value:
        min_value = value

print(min_value)

Submission status: Wrong Answer

Solution code:
import math
import sys
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

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

L_mod = L % 2019

min_value = 2020
for i in range(L+1,L+min(2018,R-L+1)):
    value = L_mod * i
    value = value % 2019
    if value < min_value:
        min_value = value

print(min_value)

Submission status: Wrong Answer

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

r1, r2 = l//mod, r//mod

if r1==r2:
	c1, c2 = l%mod, r%mod
	print(min((i*i+1)%mod for i in range(c1, c2)))
else:
	print(0)

Submission status: Wrong Answer

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

r1, r2 = l//mod, r//mod

if r1==r2:
	c1, c2 = l%mod, r%mod
	print(min(i*i+1 for i in range(c1, c2+1)))
else:
	print(0)

Submission status: Wrong Answer

Solution code:
# C - Remainder Minimization 2019(ABC133)
L,R=map(int, input().split())
A=L%2019
B=R%2019
m=A*(A+1)%2019
if L//2019==R//2019 and A!=0 and B!=0:
    for i in range(A,B+1):
        if int(2019/i)<B+1 and i<B:
            if i%3==0 and B>=673:
                print(0)
                break
            else:
                M=(int(2019/i)+1)*i
                m=min(m,M)
        elif i==B:
            print(m)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import sys
l, r = map(int, input().split())
m = 2019
min = 2019

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

Submission status: Wrong Answer

Solution code:
import sys
l, r = map(int, input().split())
m = 2019
min = 2019

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

Submission status: Wrong Answer

Solution code:
import sys
l, r = map(int, input().split())
m = 2019
min = 2019

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

Submission status: Wrong Answer

Solution code:
import sys
l, r = map(int, input().split())
m = 2019

if r - l + 1 >= 2019 or l == 0:
    print(0)
else:
    min = (l%m * (l+1)%m)%m
    for i in range(l, r):
        if i%m == 0:
            print(0)
            sys.exit()
        for j in range(i+1, r+1):
            if min > (i%m * j%m)%m:
                min = (i%m * j%m)%m
print(min)

Submission status: Wrong Answer

Solution code:
import sys
l, r = map(int, input().split())
m = 2019

if r - l + 1 >= 2019:
    print(0)
else:
    for i in range(l, r):
        if i%m == 0:
            print(0)
            sys.exit()
        for j in range(i+1, r+1):
            if i == l and j == l + 1:
                min = (i%m * j%m)%m
            else:
                if min > (i%m * j%m)%m:
                    min = (i%m * j%m)%m
print(min)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

r = 2*(10**9)
l = r - 2018

if (r-l) > 2019:
  print(0)
else:
  a = [x for x in range(l, r+1)]
  res = [i*j%2019 for i in a for j in a if i!=j]
  print(min(res))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R =map(int,input().split())
#2019*2 = 4038(二週分)
R = min(R,L+673)
ans = 2018
for i in range(L,R+1):
    for j in range(L+1,R+1):
        x= i*j%2019
        ans = min(x,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
L, R =map(int,input().split())
#2019*2 = 4038(二週分)
R = min(R,L+673)
ans = 2018
for i in range(L,R+1):
    for j in range(L+1,R+1):
        x= i*j%2019
        ans = min(x,ans)
if(L==2017 and R==2018):
    ans=2018
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
c=list(map(int,input().split()))
l,r=c[0],c[1]
if r-l>2017:
  print(0)
else:
  ml,mr=l%2019,r%2019
  if ml>mr:
    print(0)
  else:
    mini=2019
    print((ml,mr))
    d=mr-ml
    for i in range(d):
      for j in range(d-i):
        print((i,j))
        mini=min(mini,((ml+i)*(ml+i+1+j))%2019)
    print(mini)

Submission status: Wrong Answer

Solution code:
c=list(map(int,input().split()))
l,r=c[0],c[1]
if r-l>2017:
  print(0)
else:
  ml,mr=l%2019,r%2019
  if ml>mr:
    print(0)
  else:
    mini=2019
    for i in range(mr-ml):
      for j in range(ml-mr-i):
        mini=min(mini,((ml+i)*(ml+i+1+j))%2019)
    print(mini)

Submission status: Wrong Answer

Solution code:
c=list(map(int,input().split()))
l,r=c[0],c[1]
if r-l>2017:
  print(0)
else:
  ml,mr=l%2019,r%2019
  if ml>mr:
    print(0)
  else:
    mini=2019
    for i in range(mr-ml):
      for j in range(ml-mr-i):
        mini=min(mini,(i*(i+1+j))%2019)
    print(mini)

Submission status: Wrong Answer

Solution code:
c=list(map(int,input().split()))
l,r=c[0],c[1]
if r-l>2017:
  print(0)
else:
  ml,mr=l%2019,r%2019
  if ml>mr:
    print(0)
  else:
    mini=2019
    for i in range(ml,mr+1):
      for j in range(mr+1-i):
        mini=min(mini,(i*(i+j))%2019)
    print(mini)

Submission status: Wrong Answer

Solution code:
c=list(map(int,input().split()))
l,r=c[0],c[1]
if r-l>2018:
  print(0)
else:
  ml,mr=l%2019,r%2019
  if ml>mr:
    print(0)
  else:
    mini=2019
    for i in range(ml,mr+1):
      for j in range(mr+1-i):
        mini=min(mini,(i*(i+j))%2019)
    print(mini)

Submission status: Wrong Answer

Solution code:
c=list(map(int,input().split()))
l,r=c[0],c[1]
if r-l>2018:
  print(0)
else:
  ml,mr=l%2019,r%2019
  if ml>mr:
    print(0)
  else:
    print((ml*(ml+1))%2019)

Submission status: Wrong Answer

Solution code:
c=list(map(int,input().split()))
l,r=c[0],c[1]
if l-r>2018:
  print(0)
else:
  ml,mr=l%2019,r%2019
  if ml>mr:
    print(0)
  else:
    print((ml*(ml+1))%2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
r = []
if R - L >= 2018:
    print(0)
else:
    if L % 2019 == 0:
        print(0)
        exit()
    a = L // 2019
    if 2019*(a+1) <= R:
        print(0)
    else:
        r.append(L%2019)
        r.append((L+1)%2019)
        print((r[0]*r[1])%2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
r = []
if R - L >= 2018:
    print(0)
else:
    if L % 2019 == 0:
        print(0)
        exit()
    a = L // 2019
    if 2019*(a+1) <= R:
        print(0)
    else:
        if R - L > 2:
            r.append(L%2019)
            r.append((L+1)%2019)
            r.append((R-1)%2019)
            r.append(R%2019)
        else:
            r.append(L%2019)
            r.append(R%2019)
        r.sort()
        print((r[0]*r[1])%2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
r = []
if R - L >= 2018:
    print(0)
else:
    if L % 2019 == 0:
        print(0)
        exit()
    a = L // 2019
    if 2019*(a+1) <= R:
        print(0)
    else:
        if R - L > 2:
            r.append(L%2019)
            r.append((L+1)%2019)
            r.append((R-1)%2019)
            r.append(R%2019)
        else:
            r.append(L%2019)
            r.append(R%2019)
        r.sort()
        print(r[0]*r[1])

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
r = []
if R - L > 2018:
    print(0)
else:
    a = L // 2019
    if 2019*(a+1) <= R:
        print(0)
    else:
        if R - L > 2:
            r.append(L%2019)
            r.append((L+1)%2019)
            r.append((R-1)%2019)
            r.append(R%2019)
        else:
            r.append(L%2019)
            r.append(R%2019)
        r.sort()
        print(r[0]*r[1])

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
for i in range(L,R+1):
	if i % 2019 == 0:
		print(0)
		exit()
print((L*(L+1))%2019)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
for i in range(L,R+1):
	if i % 2019 == 0:
		print(0)
		break
print((L*(L+1))%2019)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
ans = 2020
ans_2 = 2020
min_index = 0
diff = 0
for i in range(L,R+1):
	if i % 2019 < ans:
		ans = i
		min_index = i
	diff += 1
	if diff > 3000:
		break

for i in range(L,R+1):
	if i == min_index:
		continue
	if i % 2019 < ans_2:
		ans_2 = i
	diff += 1
	if diff > 3000:
		break
# print(ans)
# print(ans_2)
print((ans*ans_2)%2019)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
ans = 2020
ans_2 = 2020
min_index = 0
diff = 0
for i in range(L,R+1):
	if i % 2019 < ans:
		ans = i % 2019
		min_index = i
	diff += 1
	if diff > 3000:
		break

for i in range(L,R+1):
	if i == min_index:
		continue
	if i % 2019 < ans_2:
		ans_2 = i % 2019
	diff += 1
	if diff > 3000:
		break
print(ans*ans_2)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
ans = 10000
diff = 0
if L == R:
	print((L%2019)*(L%2019))
	exit()
for i in range(L,R+1):
	if i % 2019 < ans:
		ans = i % 2019
	diff += 1
	if diff > 3000:
		break
print(ans*(ans+1))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
ans = 10000
diff = 0
if L == R:
	print((L%2019)*(L%2019))
	exit()
for i in range(L,R+1):
	print('test')
	if i % 2019 < ans:
		ans = i % 2019
	diff += 1
	if diff > 3000:
		break
print(ans*(ans+1))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
ans = 10000
diff = 0
for i in range(L,R+1):
	if i % 2019 < ans:
		ans = i % 2019
	diff += 1
	if diff > 3000:
		break
print(ans*(ans+1))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
ans = 10000
diff = 0
for i in range(L,R+1):
	if L % 2019 < ans:
		ans = L % 2019
	diff += 1
	if diff > 3000:
		break
print(ans*(ans+1))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L,R = map(int, input().split())
ans = 10000
diff = 0
for i in range(L,R):
	if L % 2019 < ans:
		ans = L % 2019
	diff += 1
	if diff > 3000:
		break
print(ans*(ans+1))

Submission status: Wrong Answer

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

if R - L > 2019:
    print(0)
else:
    l = [i % 2019 for i in range(L, R+1)]
    print(l[0] * l[1])

Submission status: Wrong Answer

Solution code:
# C - Remainder Minimization 2019(ABC133)
L,R=map(int, input().split())
A=L%2019
B=R%2019
m=A*(A+1)
if L//2019==R//2019 and A!=0:
    for i in range(A,B+1):
        if int(2019/i)<B+1:
            if 2019%i==0:
                print(0)
                break
            else:
                M=(int(2019/i)+1)*i
                m=min(m,M)
        elif i==B:
            print(m)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
# C - Remainder Minimization 2019(ABC133)
L,R=map(int, input().split())
A=L%2019
B=R%2019
if L//2019==R//2019 and A!=0:
    for i in range(A,B+1):
        if int(2019/i)<B+1:
            if 2019/i==int(2019/i):
                print(0)
                break
            else:
                if A*(A+1)>(int(2019/i)+1)*i-2019:
                    print((int(2019/i)+1)*i-2019)
                    break
                else:
                    print(A*(A+1))
                    break
        elif i==B:
            print(A*(A+1))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
# C - Remainder Minimization 2019(ABC133)
L,R=map(int, input().split())
A=L%2019
B=R%2019
if L//2019==R//2019 and A!=0:
    for i in range(A,B+1):
        if int(2019/i)<B+1:
            if 2019/i==int(2019/i):
                print(0)
                break
            else:
                if A*(A+1)>i:
                    print(i)
                    break
                else:
                    print(A*(A+1))
                    break
        elif i==B:
            print(A*(A+1))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
#C - Remainder Minimization 2019(ABC133)
L,R=map(int, input().split())
A=((R%2019)-2019)*(((R-1)%2019)-2019)
B=(L%2019)*((L+1)%2019)

if L//2019==R//2019:
    if A<B:
        print(A)
    else:
        print(B)
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#C - Remainder Minimization 2019(ABC133)
L,R=map(int, input().split())
X=[i%2019 for i in range(L,R+1)]
X.sort()
print(X[0]*X[1])

Submission status: Wrong Answer

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

result = ((L%2019) * (R%2019)) % 2019

print(result)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
base = 2019
ans = 4072325
flag = False
a = l
while(a<r):
    i_mod = a%base
    b = a+1
    while(b<r+1):
        tmp = i_mod*(b%base)
        if tmp < ans:
            ans = tmp
        if tmp == 0:
            flag = True
            break
        b += 1
    a += 1
    if flag:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
base = 2019
ans = 4072325
flag = False
a = l
while(a<r):
    i_mod = a%base
    b = a+1
    while(b<r+1):
        print("{0} {1}".format(a,b))
        tmp = i_mod*(b%base)
        print(tmp)
        if tmp < ans:
            ans = tmp
        if tmp == 0:
            flag = True
            break
        b += 1
    a += 1
    if flag:
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
ans = 0
base = 2019
MAX = 4072325
if (r-l)>=base-1:
    ans = 0
else:
    i_mod = l%base
    a = l+1
    ans = i_mod*a%base
    while(a<=r):
        tmp = a%base
        if tmp == 0:
            ans = 0
        a += 1

print(ans)

Submission status: Wrong Answer

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

if R-L<mod-1:
  a=[i%mod for i in range(L,R+1)]
  if 0 in a:
    print(0)
  else:
    print((a[0]*a[1])%mod)
else:
  print(0)

Submission status: Wrong Answer

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

if R-L<mod:
  print(((L%mod)*((L+1)%mod))%mod)
else:
  print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#たかだか2019
#かけたら超える可能性があるのか
#問題文読み違えた
#色々ダメすぎる

l,r=input().split()
l,r=int(l),int(r)
if r-l>=2018:
    print(0)
else:
    '''
    l,r=l%2019,r%2019
    if r>l:
        print(l*(l+1))
    else:
        print(0)
    '''
    '''
    x=(l*(l+1))%2019
    for i in range(l+1,r+1):
        x=min([i*(i+1),x])%2019
        if x==0:
            break
    print(x)
    '''
    a=sorted([i%2019 for i in range(l,r+1)])
    print(a[0]*a[1])

Submission status: Wrong Answer

Solution code:
#たかだか2019
#かけたら超える可能性があるのか

l,r=input().split()
l,r=int(l),int(r)
if r-l>=2018:
    print(0)
else:
    '''
    l,r=l%2019,r%2019
    if r>l:
        print(l*(l+1))
    else:
        print(0)
    '''
    x=(l*(l+1))%2019
    for i in range(l+1,r+1):
        x=min([i*(i+1),x])%2019
        if x==0:
            break
    print(x)

Submission status: Wrong Answer

Solution code:
#たかだか2019
l,r=input().split()
l,r=int(l),int(r)
if r-l>=2018:
    print(0)
else:
    l,r=l%2019,r%2019
    if r>l:
        print(l*(l+1))
    else:
        print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if l+2018 < r or l%2019 > r%2019:
	print(0)
else:
	print(l*(l+1)%2019)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
i = l-1
cnt = 0 

while i <= r :
  i = i + 1
  if i%2019 == 0 :
    print(0)
    cnt = cnt + 1

if cnt == 0:
  print(min(l*(l+1)%2019,r*(r-1)%2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if l%2019 >= r%2019:
    print(0)
elif r-l >= 2019:
    print(0)
elif l%2019 == 0 or r%2019 == 0:
    print(0)
else:
    h = []
    for i in range((r-l)%2019):
        for j in range(i, (r-l+1)%2019):
            h.append((((l+i)%2019)*((l+j)%2019))%2019)
    print(min(h))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b  = map(int,input().split())
 
if a<2019 and b<2019:
  print((a*(a+1))%2019)
elif a<2019 and b>2019:
	if abs(a-2019)>abs(b-2019):
		print((b*(b-1))%2019)
	else:
		print((a*(a+1))%2019)	
else:
  print((a*(a+1))%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if a<2019:
  print((a*(a+1))%2019)
else:
  print((b*(b+1))%2019)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
current_min = 2018
for i in range(l, r):
    mod = i % 2019
    if mod < current_min:
        current_min = mod
    if current_min == 0:
        break
if current_min == 2018:
    current_min = 0
print(current_min * (current_min + 1))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
current_min = 2018
for i in range(l, r):
    mod = i % 2019
    if mod < current_min:
        current_min = mod
    if current_min == 0:
        break
print(current_min * (current_min + 1))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
current_min = 2018
for i in range(l, r + 1):
    mod = i % 2019
    if mod < current_min:
        current_min = mod
    if current_min == 0:
        break
print(current_min * (current_min + 1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if l%2019 >= r%2019:
    print(0)
elif l%2019 == 0 or r%2019 == 0:
    print(0)
else:
    h = []
    for i in range((r-l)%2019):
        for j in range(i, (r-l+1)%2019):
            h.append((((l+i)%2019)*((l+j)%2019))%2019)
    print(min(h))

Submission status: Wrong Answer

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

if l%2019 >= r%2019:
    print(0)
elif l%2019 == 0 or r%2019 == 0:
    print(0)
else:
    h = []
    for i in range(1, (r-l)%2019+1):
        h.append(((l%2019)*((l+i)%2019))%2019)
    print(min(h))

Submission status: Wrong Answer

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

if l%2019 >= r%2019:
    print(0)
elif l%2019 == 0 or r%2019 == 0:
    print(0)
else:
    print((l%2019*r%2019)%2019)

Submission status: Wrong Answer

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

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

mod = [x % 2019 for x in range(L, R+1)]
min1, min2 = sorted(mod)[:2]
print((min1*min2)%2019)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=l%2019
rr=r%2019
if rr<ll:
    rr+=2019

ans=float('inf')
for i in range(ll,rr):
    for j in range(i+1,rr+1):
        ans=min(ans,i*j%2019)
        if ans==0:
            break
                
        
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=l%2019
rr=r%2019+2019

ans=float('inf')
for i in range(ll,rr):
    for j in range(i+1,rr+1):
        ans=min(ans,i*j%2019)
        if ans==0:
          break
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=l%2019
rr=r%2019+2019

ans=float('inf')
for i in range(ll,rr):
    for j in range(i+1,rr+1):
        ans=min(ans,i*j%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=l%2019
rr=r%2019

ans=float('inf')
for i in range(ll,rr):
    for j in range(i+1,rr+1):
        ans=min(ans,i*j%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=l%2019
rr=r%2019

ans=float('inf')
for i in range(ll,rr+1):
    for j in range(i+1,rr+1):
        ans=min(ans,i*j%2019)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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