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: Runtime Error

Solution code:
import numpy as np
L,R = map(int,input().split())
ls = []
if L*R < 2019:
    print(L*R)
else:
    for i in range(L,R):
        ls.append(i)
    def getNearestValue(lists, num):

        idx = np.abs(np.asarray(lists) - num).argmin()
        return lists[idx]


    if __name__ == "__main__":

        lists = ls
        a = 0
        b = 0
        a = getNearestValue(lists, 2019) # →0
        ls.remove(getNearestValue(lists, 2019))
        b = getNearestValue(lists, 2019)
        print((a*b) % 2019)

Submission status: Runtime Error

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

    if n % 2019 == 0or a % 2019 == 0:
        print(0)

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

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

Submission status: Runtime Error

Solution code:
import math

L, R = list(map(int, input().split()))
data = [x % 2019 for x in range(L, R+1)]
len_data = [x for x in range(len(data))]
mod_min = math.inf

for i in reversed(len_data):
    for j in range(i):
        mod = data[i] * data[j]
        mod_min = mod if mod_min > mod else mod_min

print(mod_min)

Submission status: Runtime Error

Solution code:
import math

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

_L = L % 2019
_R = R % 2019

an_L = math.ceil(2019/_L)

buff = 2019
ans = 0
while buff <= R:
    if R >= buff and L < buff:
        ans = buff
        print((L*ans)%2019)
        exit()
    buff += 2019


an_L = math.ceil(2019/_L)
# print(an_L)
if L < an_L and an_L <= R:
    print((L*an_L)%2019)
    # print('a')
    exit()

# if an_L < L

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

Submission status: Runtime Error

Solution code:
import numpy as np
import itertools

def fun(a,b):
    return (a*b)%2019

num=list(map(int,input().split()))
poi=list(itertools.combinations((range(num[0],num[1]+1)), 2))
a=[]
for i in range(len(poi)):
    a.append(fun(poi[i][0],poi[i][1]))

print(min(a))

Submission status: Runtime Error

Solution code:
import itertools

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

a = list(range(L,R))

pairs = [(a[i], a[j+i+1]) for i in range(len(a)) for j in range(len(a[i+1:]))]

print(min([pow(p[0]*p[1], 1, 2019) for p in pairs]))

Submission status: Runtime Error

Solution code:
from math import sqrt, inf

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

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

if flag:
    print(0)
else:
    lmod = l % 2019
    rmod = r % 2019
    root = int(sqrt(2019))

    n1, n2 = inf, inf
    p = lmod // root
    q = rmod // root + 1
    for m in range(p, q+1):
        for i in range(lmod, rmod+1):
            if abs(i - m * root) < n1:
                tmp = n1
                n1 = i
                n2 = tmp
            elif abs(i - m * root) < n2:
                n2 = i

    print((n1 * n2) % 2019)

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
min = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g == s:
    min2 =g

if s != 0:
  z = (s*g)%2019
  print(z)

Submission status: Runtime Error

Solution code:
import numpy as np

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

a = np.arange(L, R + 1)
a %= 2019
a.sort()

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

Submission status: Runtime Error

Solution code:
l,r=map(int,raw_input().split())
if l<2019 and r<2019:
  print(((i%2019)*(j%2019))%2019)
else:
  print('2')

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
b = []
d = [a[0]%2019, (a[1]+1)%2019]
e = sorted(d)

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

Submission status: Runtime Error

Solution code:
import sys
a,b=map(int,input().split())
if a+1==b:
  print(a*i%j)
if b-a>=2019:
  print(0)
  sys.exit()
else:
  c = 2018
  d = 2018
  if a%2019==0 or b%2019==0:
    print(0)
  else:
    for i in range(a,b-1):
      if i%2019==0:
        print(0)
        sys.exit(0)
      else:
        if c>i%2019:
          c=i%2019
          d=c+1%2019
  print(c*d%2019)

Submission status: Runtime Error

Solution code:
import math

L, R = list(map(int, input().split()))
data = [x for x in range(L, R+1)]
len_data = [x for x in range(len(data))]
mod_min = math.inf

for i in reversed(len_data):
    for j in range(i):
        mod = (data[i] * data[j]) % 2019
        mod_min = mod if mod_min > mod else mod_min

print(mod_min)

Submission status: Runtime Error

Solution code:
import numpy as np
import itertools

def fun(a,b):
    return (a*b)%2019

num=list(map(int,input().split()))
poi=list(itertools.combinations(list(range(num[0],num[1]+1)), 2))
a=[]
for i in range(len(poi)):
    a.append(fun(poi[i][0],poi[i][1]))

print(min(a))

Submission status: Runtime Error

Solution code:
L, R = [int(i) for i in input().split()]
tmp = 2018
for i in range(diff):
    ii = L+i
    for j in range(diff-i):
#         ii = L+i
        jj = R-j
        mod = ii*jj%2019
        #print(ii, jj, mod)
        if tmp>mod:
            tmp=mod
print(tmp)

Submission status: Runtime Error

Solution code:
import math
l,r = list(map(int,input().split()))
f = [0]*2020
x = []
ans = 2020
for i in range(l,r):
    if f[i%2019] == 0:
        x.append(i%2019)
        f[i%2019] = 1
    else:
        break
x.sort()


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

Submission status: Runtime Error

Solution code:
from itertools import combinations as comb

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

arr = range(R + 1)
arr = arr[L:]

# print([_ for _ in arr])

# exec
ans = 2019
for c in comb(arr, 2):
    i = c[0]
    j = c[1]
    tmp = (i * j) % 2019
    if tmp < ans:
        ans = tmp

print(ans)

Submission status: Runtime Error

Solution code:
lr = list(map(int, input().split()))
l = lr[0]
r = lr[1]
lmod = l%2019

def minfunc(x, y):
    if x > y:
        return y
    else:
        return x

if r - l >= 2019:
    print(0)
elif 2019 <= r - l + lmod:
    print(0)
else:
    min = 9999999
    for i in list(map(lambda x: x%2019,range(l,r)):
        for j in list(map(lambda x: x%2019, range(i,r+1))):
            min = minfunc(minfunc(i,j),min)
    print(min)

Submission status: Runtime Error

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

vlist = []

    v = (l+x) % 2019
    vlist.append(v)

vlist.sort()
#print(vlist)

#res = i*j % 2019
print(vlist[0]*vlist[1])

Submission status: Runtime Error

Solution code:
l,r=map(int,raw_input().split())
if l<2019 and r<2019:
  print(((i%2019)*(j%2019))%2019)
else:
  print(((l%2019)*((l+1)%2019)%2019))

Submission status: Runtime Error

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

vlist = []

    v = (l+x) % 2019
    vlist.append(v)

vlist.sort()
print(vlist)

#res = i*j % 2019
print(vlist[0]*vlist[1])

Submission status: Runtime Error

Solution code:
lr = list(map(int, input().split()))
l = lr[0]
r = lr[1]
lmod = l%2019

def minfunc(x, y):
    if x > y:
        return y
    else:
        return x

if r - l >= 2019:
    print(0)
elif 2019 <= r - l + lmod:
    print(0)
else:
    min = 9999999
    for i in list(map(lambda x: x%2019,range(l,r)):
        for j in list(map(lambda x: x%2019, range(i,r+1))):
            min = minfunc(minfunc(i,j),min)

Submission status: Runtime Error

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:
        m = 2019
        for i in range(lm, rm):
            for j in range(i+1, rm+1):
                m = min(i * j % 2019, m)
print(m)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
L, R = [int(i) for i in input().split()]
tmp = 2018
for i in range(diff):
    ii = L+i
    for j in range(diff-i):
#         ii = L+i
        jj = R-j
        mod = ii*jj%2019
        print(ii, jj, mod)
        if tmp>mod:
            tmp=mod
print(tmp)

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
l=L//2019
r=R//2019
if l==r:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            a=i*j
            b=a%2019
            if c>b:
                c=b
        if c==0:
            break
    print(c)
else:
    print(0)

Submission status: Runtime Error

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

int_list = list(range(l,r+1))
l = len(int_list)
min_mod = 2018

for i in range(l):
    for j in range(l):
        if j > i:
            compare = int_list[i]*int_list[j]%2019
            if compare < min_mod:
                min_mod = compare


print(min_mod)

Submission status: Runtime Error

Solution code:
from math import sqrt, inf

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

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

if flag:
    print(0)
else:
    lmod = l % 2019
    rmod = r % 2019
    root = int(sqrt(2019))

    n1, n2 = inf, inf
    for i in range(lmod, rmod+1):
        if abs(i - root) < n1:
            tmp = n1
            n1 = i
            n2 = tmp
        elif abs(i - root) < n2:
            n2 = i

    print((n1 * n2) % 2019)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
mod=2019
if R-L>=2020:
    print(0)
    exit()
else:
    l=[]
    for i in range(L,R+1):
        l.append(i%mod)
ans=2018
for i in l:
    for j in l:
        if i!=j:
            ans=min(ans,l[i]*l[j]%mod)
print(ans)

Submission status: Runtime Error

Solution code:
L,R= map(int,input().split())
#境界条件
if L == 0:
    ans = 0
#一個違い
elif R == L+1:
    ans = L*R % 2019
else:
    l = L % 2019
    r = R % 2019
    for i in range(l,r):
        for j in range(l+1,r+1):
            temp = (i * j) % 2019
            if i == 1 and j==2:
                min = temp
            elif min > temp:
                min = temp
    ans = min
print(ans)

Submission status: Runtime Error

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

numbers = list(range(l, r+1))

if r-l>2019:
    print(0)
    exit()


amari = list(set([x%2019 for x in numbers]))


cnt = 2019
for i in range(len(amari)):
    for j in range(len(amari)):
        if i == j:
            continue
        if amari[i]*amari[j]%2019 < cnt:
            cnt = amari[i]*amari[j]%2019


print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
k=[]
a=l-(l-1)%2019+2018
if a<=r:
  print(0)
else:
  for i in range(l+1,r+1):
    for j in range(l,i):
      k.append((i*j)%2019)
print(min(k))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
number = list(range(L,R+1))
min = 2100
for i in range(len(number) - 1):
    j = i + 1
    while(j < len(number)):
        if(min > number[i]*number[j] % 2019):
            min = number[i]*number[j] % 2019
        j += 1
print(min)

Submission status: Runtime Error

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

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R - L >= 2019 - 1:
        print(0)
    if R % 2019 <= L % 2019:
        print(0)
    else:
        L = L % 2019
        R = R % 2019
        
        smallest = 10000000
        for i in range(L, R):
            for j in range(i+1, R+1):
                calc = (i*j)%2019
                if calc < smallest:
                    smallest = calc
    print(smallest)
    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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll INF = 1e9;
// const ll MOD = 1e9 + 7;
const ll MOD = 2019;

int main(){
    ll L, R;
    cin >> L >> R;

    if (L + 1 == R) {
        cout << (L * R) % 2019 << endl;
        return 0;
    }

    // find min-i
    int mv = INF;

    vector<int> values = {(int)L};
    for (int i = L + 1; i < R; i++) {
        values.push_back(i);
        if (L % 2019 == i % 2019)
            break;
    }
    for (auto v : values) {
        for (int j = v + 1; j <= R; j++) {
            mv = min(mv, (v * j) % 2019);
            if ((v + 1) % 2019 == (j % 2019) && j > v + 1)
                break;
        }
    }
    cout << mv << endl;
}

Submission status: Runtime Error

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

MOD = 2019  # type: int

def solve(L: int, R: int):
    #if R - L >= 2019 - 1:
    if R % 2019 < L % 2019:
        print(0)
    else:
        L = L % 2019
        R = R % 2019
        
        smallest = 10000000
        for i in range(L, R):
            for j in range(i+1, R+1):
                calc = (i*j)%2019
                if calc < smallest:
                    smallest = calc
    print(smallest)
    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: Runtime Error

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

Submission status: Runtime Error

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

L_1 = L % 2019
R_1 = R % 2019

idx1 = 0
listA = []
for idx1 in range(L_1, R_1):
  idx2 = idx1 + 1
  for idx2 in range(idx1 + 1, R_1 + 1):
    listA.append(idx1 * idx2)

print(min(listA))

Submission status: Runtime Error

Solution code:
if (R - L) // 2019 > 0:
    print(0)
elif (R - L) != (R % 2019 - L % 2019):
    print(0)
else:
    print(min(L * (L + 1) % 2019, R * (R - 1) % 2019, L * R % 2019))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L,R=map(int, input().split())
n=R-L
ans=[]

for i in range(n):
    l=L+i
    for j in range(i+1, n):
        r=l+j
        if r > R:
            break
        ans.append((l*r) % 2019)
print(min(ans))

Submission status: Runtime Error

Solution code:
d = list(map(int, input().split()))
L = d[0]
R = d[1]

a = L//2019
b = L//2019
c = L%2019
d = R%2019

list = []

if b-a >= 2:
  print(0)

elif b - a == 1:
  if d - c >= 0:
    print(0)
  else:
    for i in range(c,d+2019):
      for j in range(i+1,d+2019+1):
        list.append(i*j%2019)
    print(min(list)) 

else :
  for i in range(c,d):
    for j in range(i+1,d+1):
        list.append(i*j%2019)
  print(min(list))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
number = list(range(L,R+1))
min = 2100
for i in range(len(number)):
    j = i + 1
    while(j < len(number)):
        if(min > number[i]*number[j] % 2019):
            min = number[i]*number[j] % 2019
        j += 1
print(min)

Submission status: Runtime Error

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

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R - L >= 2019 - 1:
        print(0)
    else:
        L = L % 2019
        R = R % 2019
        
        smallest = 10000000
        for i in range(L, R):
            for j in range(i+1, R+1):
                calc = (i*j)%2019
                if calc < smallest:
                    smallest = calc
    print(smallest)
    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: Runtime Error

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

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
min = 2019
n = y-x
for i in range(n):
  s = (x + i) % 2019
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
for j in range(n):
  g = (x + j) % 2019
  if g == 0:
    break
  elif min2 > g and g == s:
    min2 =g

if s != 0:
  z = (s*g)%2019
  print(z)

Submission status: Runtime Error

Solution code:
L,R = map(int,input().split())
def judge_distance(i,j):
    if j-i >= 2019:
        return True

def search_2019(i,j):
    res = False
    for p in range(j-i+1):
        if i+p % 2019 == 0:
            res = True
            exit()

if judge_distance(L,R) or search_2019(L,R):
    print(0)
else:
    mincount = float("inf")
    for i in range(L,R):
        for j in range(L+1,R+1):
            if i*j%2019 <= mincount:
                mincount = (i*j)%2019

print(mincount)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
x=list(range(l,r+1))
if r-l+1>4038:
  x=list(x[0:4038])
y=list()
for n in x:
  y=y+[n%2019]
y.sort()
print(y[0]*y[1])

Submission status: Runtime Error

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

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R - L >= 2019 - 1:
        print(0)
    else:
        L = L % 2019
        R = R % 2019
        
        smallest = 10000000
        for i in range(L, R+1):
            for j in range(i+1, R+1):
                calc = (i*j)%2019
                if calc < smallest:
                    smallest = calc
    print(smallest)
    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: Runtime Error

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

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


print(ans)

Submission status: Runtime Error

Solution code:
L,R=map(int, input().split())
n=R-L
x=[i+L for i in range(n)]
ans=[]

for i in range(n):
    l=L+i
    for j in range(i+1, n):
        r=l+j
        if r >= R:
            break
        ans.append((l*r) % 2019)
print(min(ans))

Submission status: Runtime Error

Solution code:
import math

L, R = list(map(int, input().split()))
data = [x for x in range(L, R+1)]

mod_min = math.inf
for x in data:
    for y in data:
        if x == y:
            continue
            
        mod = (x * y) % 2019
        mod_min = mod if mod_min > mod else mod_min

print(mod_min)

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
min = 2019
for i in range(y - x):
  s = (x + i) % 2019
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
for j in range(y -x):
  g = (x + i) % 2019
  if g == 0:
    break
  elif min2 > g and g == s:
    min2 =g

if s != 0:
  z = (s*g)%2019
  print(z)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input().rstrip().split(' ')
L = int(s[0])
R = int(s[1])
cnt = (L*(L+1)) % 2019
 
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if ans < cnt:
            cnt = ans
        	if cnt == 0:
    			break
    if cnt == 0:
      break

print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

import numpy as np
ms = np.array(np.unique(np.arange(L, R+1) % 2019))

Ms = ms.reshape(-1,1)*ms.reshape(1,-1)
Ms = Ms % 2019
Ms += np.eye(Ms.shape[0], dtype=int)*2019
print(np.min(Ms))

Submission status: Runtime Error

Solution code:
import math
l,r=map(int,input().split())
a=l%2019
b=r%2019
if l-r>=2019:
    print(0)
elif b-a<=0:
    print(0)
elif (a%3==0)&(b%673==0):
    print(0)
elif (a%3==0)&(b%3==0):
    print(0)
elif a<=20&b>=101:
    print(1)
else:
    ans=2018
    for i in range(a,b+1):
        for j in range(i+1,b+1):
            ans=min(ans,i*j%2019)
print(ans)

Submission status: Runtime Error

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

ans_list=[]
for v in itertools.combinations(range(L,R+1),2):
  buf1 = v[0]%2019
  buf2 = v[1]%2019
  ans_list.append((buf1*buf2)%2019)
print(min(ans_list))

Submission status: Runtime Error

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

res = 1000000007

if R - L + 1 > 2019:
    print(0)
else:
    amari = [i % 2019 for i in range(L, R + 1)]
    l = len(amari)
    for i in range(l + 1):
        a = amari[i]
        for j in range(i + 1, l + 1):
            b = amari[j]
            res = min(res, a * b % 2019)

    print(res)

Submission status: Runtime Error

Solution code:
from fractions import gcd


l, r = map(int, input().split())
lr_ans = []
for i in range(l, r+1):
    lr_ans.append(i%2019)
lr_ans.sort()
print(int(lr_ans[0]*lr_ans[1]/gcd(lr_ans[0], lr_ans[1])))

Submission status: Runtime Error

Solution code:
import math

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

_L = L % 2019
_R = R % 2019

an_L = math.ceil(2019/_L)
# print(an_L)
if L < an_L and an_L <= R:
    print((L*an_L)%2019)
    # print('a')
    exit()

# if an_L < L

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

Submission status: Runtime Error

Solution code:
import math

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

ls = l % 2019
rs = r % 2019

dif = r // 2019 - l // 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (r - l == 1):
    print(lr*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs)))
    print(min(mini))

Submission status: Runtime Error

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

ans_list=[]
for v in itertools.combinations(range(L,R+1),2):
  ans_list.append((v[0]*v[1])%2019)
print(min(ans_list))

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
lst=list(range(l,r+1))
modlist=[]
for i in lst:
	q,mod = divmod(i,2019)
	modlist.append(mod)
sor = sorted(modlist)
print(sor[0]*sor[1])

Submission status: Runtime Error

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

res = 1000000007

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

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

    print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

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

# mod 2019 の答えは 0 ~ 2018 のいずれか
# modは積のそれぞれを取ってから掛けても同じ
np_nums = np.sort(np.mod(np.arange(L, R + 1), 2019))

# 最も小さい2値の積が答え
ans = (np_nums[0] * np_nums[1]) % 2019
print(ans)

Submission status: Runtime Error

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

if L == 0 or L%2019 == 0 or R%2019 == 0:
  print(0)
  exit()
elif R - L == 1:
  print(L*R)
  exit()

a = list(range(L,R+1))

N = len(a)
r = 0
total = []

for l in range(N):
  r = l + 1
  while r < N:
    total.append((a[l]*a[r])%2019)
    r += 1
  if l == r:
    l += 1
    
print(min(total))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
lr = list(map(int, input().split()))
l = lr[0]
r = lr[1]
lmod = l%2019

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

numbers = list(range(l, r+1))

amari = list(set([x%2019 for x in numbers]))

mods = []
for i in range(len(amari)):
    for j in range(len(amari)):
        if i == j:
            continue
        mods.append((amari[i]*amari[j]%2019))

print(min(mods))

Submission status: Runtime Error

Solution code:
import numpy as np

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

a = np.arange(L, R + 1)

# print(a)

a %= 2019

a.sort()

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

Submission status: Runtime Error

Solution code:
L,R = map(int,input().split())
L_mod = L % 2019
A = 2019 - L_mod
if A <= R-L:
  print(0)
else:
  ans = 2018
  for i in range(R-L+1):
    for j in range(i+1,R-L+1):
      temp = (L_mod + i) * (L_mod + j) % 2019
      if temp <= ans:
        ans = temp
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

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

LR = np.arange(l, r + 1)
LR = LR % 2019
idx_1 = LR.argmin()
min_1 = LR[idx_1]
LR[idx_1] = 2018
min_2 = LR.min()


print(min_1 * min_2)

Submission status: Runtime Error

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

if (l==2019)or(r==2019)or(r-l>=2019):
    print('0')
    
elif r-l==1:
    ans = (r*l)%2019
else:
    ans=2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            if (i*j)%2019 < ans:
                ans = (i*j)%2019
            if ans == 1:
                break
            
print(str(ans))

Submission status: Runtime Error

Solution code:
import sys
from math import *
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

num = 2019
l, r = na()
li = []
if r < num:
    print(l * r)
elif l <= num <= r:
    print(0)
elif l > num:
     if r - l >= num:
         print(0)
     else:
         for i in range(l, r+1):
             li.append(i%num)
     li.sort()
     print(li[0] * li[1])

Submission status: Runtime Error

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math

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

_L = L % 2019
_R = R % 2019

an_L = math.ceil(2019/_L)
# print(an_L)
if L < an_L and an_L <= R:
    print((L*an_L)%2019)
    # print('a')
    exit()

# if an_L < L

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

Submission status: Runtime Error

Solution code:
import itertools

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

poss = list(range(L,R))

print(min([pow(p[0]*p[1], 1, 2019) for p in itertools.combinations(poss, 2)]))

Submission status: Runtime Error

Solution code:
import math

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

_L = L % 2019
_R = R % 2019

an_L = math.ceil(2019/_L)
print(an_L)
if L < an_L and an_L <= R:
    print((L*an_L)%2019)
    # print('a')
    exit()

# if an_L < L

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