Problem: 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.

Submission attempts (in order):
l,r = map(int,input().split())

for h in range(0,2):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))


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

for h in range(0,10):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))


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

for h in range(0,100):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		if i % (2019-h) == 0:
			print(h)
			exit()

lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))


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

for h in range(0,3):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))


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

for h in range(0,100):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		if i % (2019-h) == 0:
			print(h)
			exit()

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




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

for h in range(0,20):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))


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

for h in range(0,673):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))


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

for h in range(0,10):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))


l,r = map(int,input().split())
'''
for h in range(0,2):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
'''
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		if (i*j)%2019 == 0:
			print(0)
			exit()
		lst.append((i*j)%2019)

print(min(lst))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted