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: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
i, j = map(int,input().split())
ans = 100000000

for m in range(i, j):
  for n in range(m+1, j+1):
    x = m * n % 2019
    if x < ans:
      ans = x

print(ans)

Submission status: Time Limit Exceeded

Solution code:
mtx = [[0] * 2019 for _ in range(2019)]

for i in range(len(mtx)):
    for j in range(len(mtx)):
        mtx[i][j] = (i * j) % 2019

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

min_val = 10000000

for i in range(l % 4040, r+1 % 4040):
    for j in range(i+1 % 4040, r+1 % 4040):
        a = i % 2019
        b = j % 2019
        ret = mtx[a][b]
        min_val = min(min_val, ret)

print(min_val)

Submission status: Time Limit Exceeded

Solution code:
mtx = [[0] * 2019 for _ in range(2019)]

for i in range(len(mtx)):
    for j in range(len(mtx)):
        mtx[i][j] = (i * j) % 2019

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

min_val = 10000000

for i in range(l, r+1):
    for j in range(i+1, r+1):
        a = i % 2019
        b = j % 2019
        ret = mtx[a][b]
        min_val = min(min_val, ret)

print(min_val)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans=10**9+1


for i in range(L,R+1,1):
  if i==2019:
    break
  for j in range(L,R+1,1):
    if j==2019:
      break

    if i<j:
      ans=min((i*j)%2019,ans)

if ans==10**9+1:
  ans=0
  

print(ans)

Submission status: Time Limit Exceeded

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

ans=10**9+1
for i in range(L,R+1,1):
  for j in range(L,R+1,1):
    if i<j:
      ans=min(i*j%2019,ans)
print(ans)

Submission status: Time Limit Exceeded

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

m = 10000000000000000
cnt_i = 0
for i in range(l,r+1):
    cnt_j = 0
    if cnt_i == 2019:
        break
    cnt_i += 1
    for j in range(i+1,r+1):
        if cnt_j == 2019:
            break
        cnt_j += 1
        m = min(m,i%2019*j%2019)
print(m)

Submission status: Time Limit Exceeded

Solution code:
#C
l, r = map(int, input().split())
ans=2018
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        if i * j % 2019 < ans:
            ans = i * j % 2019
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

res = []
for i in range(L,R):
    for j in range(L+1,R+1):
        res.append((i*j)%2019)
print(min(res))

Submission status: Time Limit Exceeded

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product

def resolve():
    L,R=map(int,input().split())
    minmod=10**10
    for i in range(L,R):
        for j in range(i+1,R+1):
            minmod=min(minmod,(i*j)%2019)
    print(minmod)

resolve()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(min(t))

Submission status: Time Limit Exceeded

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

A =[]
for i in range(L ,R):
    for j in range(L+1,R+1):
        #print(i,j)
        b = i*j % 2019
        A.append(b)
ans = min(A) 
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

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

min = 2019
for i in range(L,R):
    for j in range(i+1,R+1):
        x = (i * j) % 2019
        if x < min:
            min = x
print(min)

Submission status: Time Limit Exceeded

Solution code:
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')

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

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')
    for i in range(L, R):
        for j in range(L + 1, R + 1):
            ret = min(ret, (i * j) % MOD)

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
MOD = 2019

L, R = [int(i) for i in input().strip().split()]

res = R*R
for i in range(L, R):
  for j in range(i+1, R+1):
    _, r = divmod(i*j, MOD)
    if r < res:
      res = r
print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

min = (L*R)%2019

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

print(min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#abc133 c
L,R=map(int,input().split())
ans=0
R=min(R,L+2019*2)
ans=2018
amari=[]
for i in range(L,R+1):
    tmp=i%2019
    amari.append(tmp)
    if len(amari)==2019*2:
        break
for i in range(len(amari)):
    for j in range(len(amari)):
        if i==j:
            continue
        ans=min(ans,(amari[i]*amari[j])%2019)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#abc133 c
L,R=map(int,input().split())
x=R-L
ans=0
R=min(R,L+2019*2)
ans=2018
for i in range(L,R+1):
    for j in range(i+1,R+1):
        amari=(i*j)%2019
        ans=min(ans,amari)
print(ans)

Submission status: Time Limit Exceeded

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

mod = 2019
ans = 10000
a = [i%mod for i in range(l,r+1)]


for i in range(len(a)):
	for j in range(len(a)):
		if i == j:
			continue
		ans = min(ans,(a[i]*a[j])%mod)
		if ans == 0:
			print(ans)
			sys.exit()

print(ans)

Submission status: Time Limit Exceeded

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

mod = 2019
ans = 10000
a = [i%mod for i in range(l,r+1)]


for i in range(len(a)):
	for j in range(len(a)):
		if i == j:
			continue
		ans = min(ans,(a[i]*a[j])%mod)
		if ans == 0:
			break
			
print(ans)

Submission status: Time Limit Exceeded

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

mod = 2019
ans = 10000
a = [i%mod for i in range(l,r+1)]


for i in range(len(a)):
	for j in range(len(a)):
		if i == j:
			continue
		ans = min(ans,(a[i]*a[j])%mod)

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
a, b = map(int, input().split())
ans = 200000
for i in range(a, b):
    for j in range(a+1, b+1):
        ans = min(ans, i*j%2019)
        if ans == 0:
            break

print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

ans = 100100100100
for i in range(L, R+1):
    for j in range(L, i):
        ans = min(ans, (i*j)%2019)
    """
    if ans == 0:
        print(ans)
        exit()
    """
print(ans)

Submission status: Time Limit Exceeded

Solution code:

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

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


print(mini)

Submission status: Time Limit Exceeded

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


def main():
    L, R = map(int, input().split())
    result = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            result.append(i * j % 2019)
    print(min(result))


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
L,R = map(int,input().split())
ans = set()
mini = 2019
for i in range(L,R+1):
  ans.add(i%2019)
  
for i in ans:
  for j in ans:
    if (i*j)%2019 < mini and i != j:
      mini = (i*j)%2019
print(mini)

Submission status: Time Limit Exceeded

Solution code:
L,R = map(int,input().split())
mini = 2019
for i in range(L,R+1):
  for j in range(L,R+1):
    if (i*j)%2019 < mini and i != j:
      mini = (i*j) % 2019
print(mini)

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
mod = 2019
s = 2018
for i in range(L, R):
    for j in range(i+1, R+1):
        t = (i%mod)*(j%mod)%mod
        if s > t:
            s = t
print (s)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

l,r = map(int,input().split())
mod = 2019
a = range(l, r + 1)
for i in range(mod):
    m = l * (l + 1)
    M = (r - 1) * r
    for j in range(m // mod, M // mod + 1):
        b = j * mod + i
        c = make_divisors(b)
        #print(b, c)
        for k in c:
            d = b // k
            #print(k, d)
            if k != d and l <= k and k <= r and l <= d and d <= r:
                #print('i: ',end='')
                print(i)
                sys.exit()

Submission status: Time Limit Exceeded

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

count_limit = 0 # count limit is 2019
min_num = 2020
for i in range(L, R+1):
    for j in range(i+1, R+1):
        min_num = min(min_num, (i*j)%2019)

    # limit process
    count_limit = count_limit + 1
    if count_limit>2020:
        break

print(min_num)

Submission status: Time Limit Exceeded

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

ans = pow(10,9)+7
for i in range(L,min(R,L+mod+1)):
  for j in range(i+1,min(R+1,i+1+mod+1)):
    val = ((i%mod) * (j%mod))%mod
    ans = min(ans, val)

print(ans)

Submission status: Time Limit Exceeded

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

ans = 2*pow(10,9)+7
for i in range(L,R):
  for j in range(i+1,R+1):
    val = ((i%mod) * (j%mod))%mod
    ans = min(ans, val)
    if ans == 0:
      break

print(ans)

Submission status: Time Limit Exceeded

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

ans = pow(10,9)+7
for i in range(L,R):
  for j in range(i+1,R+1):
    val = ((i%mod) * (j%mod))%mod
    ans = min(ans, val)
    if ans == 0:
      break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    l, r = list(map(int, readline().split()))
    t = 10 ** 20
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            t = min(t, i * j % 2019)
        if t == 0:
            break
    print(t)


if __name__ == '__main__':
    solve()

Submission status: Time Limit Exceeded

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    l, r = list(map(int, readline().split()))
    t = 10 ** 20
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            t = min(t, i * j % 2019)
            if t == 0:
                break
    print(t)


if __name__ == '__main__':
    solve()

Submission status: Time Limit Exceeded

Solution code:
l,r=map(int,input().split())
ans=int(10000000)
if r-l>2019:
    ans=0

for i in range(l,r):
    for j in range(i+1,r+1):
        now=int((i*j)%2019)
        if ans>now:
            ans=now

print(ans)

Submission status: Time Limit Exceeded

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

ans = 1000000000
for i in range(l, r):
  for j in range(i + 1, r + 1):
    ans = min((i * j) % 2019, ans)
    #割り切れた場合はそれが最小値なので探索終了とする
    if ans == 0:
      break

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split())
ans = 2020
for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = i * j % 2019
        ans = tmp if tmp < ans else ans
        if ans == 0:
            break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
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 == 0:
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
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 == 0:
            break
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = sys.stdin.readline

def eprint(s):
    if type(s) != type('str'):
        s=str(s)

    sys.stderr.write(s+'\n')
    return

def main():
    l, r = map(int, input().split())
    if l <= 2019 and 2019 <= r:
        print(0)
        return 
    if l-r >= 2019:
        print(0)
        return

    m = 10**9

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

ans_list = []
for i in range(2 * 10**9):
  if l + 1 > r:
    break
  ans = (l * (l + 1)) % 2019
  ans_list.append(ans)
  if ans == 0:
    break
print(min(ans_list))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import itertools


L, R = map(int, input().split())
num_list = [i for i in range(L, R + 1)]
l = list(itertools.combinations(num_list, 2))
INF = float('inf')
ans = INF
for i in range(len(l)):
    if ans > (l[i][0] * l[i][1]) % 2019:
        ans = (l[i][0] * l[i][1]) % 2019
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools
L, R = map(int, input().split())
num_list = [i for i in range(L, R + 1)]
l = list(itertools.combinations(num_list, 2))

ans_list = [0 for _ in range(len(l))]
for i in range(len(ans_list)):
    ans_list[i] = (l[i][0] * l[i][1]) % 2019
print(min(ans_list))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

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

ans = 2200
for i in range(l, r):
    if i % 2019 == 0:
        pass
    else:
        for j in range(i+1, r+1):
            if i == j:
                continue
            elif j % 2019 == 0:
                continue
            else:
                tmpans = (i * j) % 2019
            ans = min(ans, tmpans)


print(ans)

Submission status: Time Limit Exceeded

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

ans = 2200
for i in range(l, r):
    if i % 2019 == 0:
        pass
    else:
        for j in range(l+1, r+1):
            if i == j:
                continue
            elif j % 2019 == 0:
                continue
            else:
                tmpans = (i * j) % 2019
            ans = min(ans, tmpans)


print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

ans = []
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        v = i * j % 2019
        ans.append(v)
        if v == 0:
            break

print(min(ans))

Submission status: Time Limit Exceeded

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

min = MOD
for i in range(l, r):
    if min == 0: break
    for j in range(i+1, r+1):
        im, jm = i % MOD, j % MOD
        val = (im * jm) % MOD
        if val < min:
            min = val
print(min)

Submission status: Time Limit Exceeded

Solution code:
import sys

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

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

m = 10**9

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

    if m > s:
      m = s

print(m)

Submission status: Time Limit Exceeded

Solution code:
import sys

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

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

m = 10**9

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

    if m > s:
      m = s

print(m)

Submission status: Time Limit Exceeded

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

listLR = [a for a in range(L, R+1)]

flg = 0
for i in range(len(listLR)):
    if listLR[i] % 2019 == 0:
        flg = 1
        break

ans = 0
modL = L % 2019
modR = R % 2019
min2019 = 2019

if flg == 1:
    print(0)
elif modL <=3 and modR >=673:
    print(0)
else:
    for j in range(modL, modR+1):
        for k in range(j+1, modR+1):
            if j * k % 2019 < min2019:
                min2019 = j * k % 2019
    print(min2019)

Submission status: Time Limit Exceeded

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

for i in range(L, R+1):
    for j in range(i+1, R+1):
        mod = (i * j) % 2019
        mini = min(mini, mod)
        
        if (mini == 0):
            break

print(mini)

Submission status: Time Limit Exceeded

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

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

print(mini)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

    res = 2018
    for i in range(l, r):
        for j in range(l+1, r+1):
            mod = (i*j)%2019
            if mod < res:
                res = mod
            if res == 0:
                break
        else:
            continue
        
    print(res)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

    res = 2018
    for i in range(l, r):
        for j in range(l+1, r+1):
            mod = (i*j)%2019
            if mod < res:
                res = mod
            if res == 0:
                break
    print(res)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

A = set()

for i in range(L, R):
    for j in range(i+1, R+1):
        A.add(i*j % MOD)
        if i * j % MOD == 0:
            break

print(min(A))

Submission status: Time Limit Exceeded

Solution code:
L, R = [int(i) for i in input().split()]
R = min(R, L + 4038)
diff = R - L
ans = 2018
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = i * j % 2019
        ans = min(ans, x)
print(ans)

Submission status: Time Limit Exceeded

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

R = min(R, L+4038)

ans =  2018

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

Submission status: Time Limit Exceeded

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

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

if flg == True:
    print(0)
else:
    print(m)

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int,input().split())
lst = [i%2019 for i in range(L,R+1)]
lst = set(lst)
lst = list(lst)
N = len(lst)
ans = 10**8
for i in range(N-1):
    for j in range(i+1,N):
        if ans>(lst[i]*lst[j])%2019:
            ans = (lst[i]*lst[j])%2019
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

lt = []
for j in range(l, r+1, 1):
    for i in range(l, j):
        lt.append((i*j)%2019)
        
print(min(lt))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    L, R = LI()
    diff = R - L
    L %= 2019
    R = min(L + diff, R % 2019 + 2019)
    ans = inf
    for i in range(L, R):
        for j in range(L + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
    print(ans)

main()

Submission status: Time Limit Exceeded

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

print(count)

Submission status: Time Limit Exceeded

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

if r-l >= 2019:
    ans = 0
else:
    ans = 2018
    for i in range(r-1):
        for j in range(i+1,r-l+1):
            mod = ((l+i)*(l+j))%2019
            if ans > mod:
                ans = mod

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

if L - R >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            a = (i * j) % 2019
            if a < ans:
                ans = a

print(ans)