TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
import math
N,D=map(int,input().split())
X=[list(map(int,input().split()))for i in range(N)]
ans=0
dist=0.0
for i in range(N):
    for j in range(i+1,N):
        dist=0.0
        for k in range(D):
            dist+=(X[i][k]-X[j][k])**2
        print(dist.is_integer())
        if dist.is_integer() is True:
            ans+=1
print(ans)

import math
N,D=map(int,input().split())
X=[list(map(int,input().split()))for i in range(N)]
ans=0
dist=0.0
for i in range(N):
    for j in range(i+1,N):
        dist=0.0
        for k in range(D):
            dist+=(X[i][k]-X[j][k])**2
        dist=math.sqrt(dist)
        if dist.is_integer() is True:
            ans+=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
import numpy as np

N, D = map(int, input().split())
X = np.array([list(map(int, input().split())) for _ in range(N)])
ans = 0
Dist = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        Dist = np.sum((X[i] - X[j]) ** 2)
        print(Dist)
        for k in range(1, Dist // 2 + 2):
            if k ** 2 == Dist:
                ans += 1
print(ans)

import numpy as np

N, D = map(int, input().split())
X = np.array([list(map(int, input().split())) for _ in range(N)])
ans = 0
Dist = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        Dist = np.sum((X[i] - X[j]) ** 2)
        for k in range(1, Dist // 2 + 2):
            if k ** 2 == Dist:
                ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
n,d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

cnt=0
for i in range(n):
    for j in range(i+1,n):
        sum=0
        for k in range(d):
            sum += (x[i][k]-x[j][k])**2
        route = sum**0.5
        if route.is_integer:
            cnt += 1

print(cnt)

n,d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

cnt=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(d):
            sum=0
            sum += (x[i][k]-x[j][k])**2
        route = sum**0.5
        if route.is_integer:
        cnt += 1
        
print(cnt)

n,d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

cnt=0
for i in range(n):
    for j in range(i+1,n):
        sum=0
        for k in range(d):
            sum += (x[i][k]-x[j][k])**2
        route = sum**0.5
        if route.is_integer:
            cnt += 1

print(cnt)

n,d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

cnt=0
for i in range(n):
    for j in range(i+1,n):
        sum=0
        for k in range(d):
            sum += (x[i][k]-x[j][k])**2
            route = sum**0.5
            if route.is_integer:
              cnt += 1

print(cnt)

n,d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

cnt=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(d):
            sum=0
            sum += (x[i][k]-x[j][k])**2
            route = sum**0.5
            if route.is_integer:
                cnt += 1
print(cnt)

n,d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
cnt=0

for i in range(n):
    for j in range(i+1,n):
        distance=0
        for k in range(d):
            distance += (x[i][k]-x[j][k])**2
        if (distance**0.5).is_integer():
            cnt += 1
print(cnt)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
import math
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
def distance(a,b):
  s = 0
  for i in range(d):
    s += (a[i]-b[i])**2
  return math.sqrt(ans)
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    if distance(x[i],x[j])//1 == distance(x[i],x[j]):
      ans += 1
print(ans)

import math
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
def distance(a,b):
  s = 0
  for i in range(d):
    s += (a[i]-b[i])**2
  return math.sqrt(s)
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    if distance(x[i],x[j])//1 == distance(x[i],x[j]):
      ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
import math

n,d = map(int, input().split())
x_array = []
for i in range(n):
  x_array.append(list(map(int, input().split())))

  ans = 0
for i in range(1,n):
  for j in range(i):
    print(i, j)
    list1 = x_array[i]
    list2 = x_array[j]
    count = 0
    for k in range(len(list1)):
      count += (list1[k]-list2[k]) ** 2

    if math.sqrt(count) == int(math.sqrt(count)):
      ans += 1

print(ans)

import math

n,d = map(int, input().split())
x_array = []
for i in range(n):
  x_array.append(list(map(int, input().split())))

  ans = 0
for i in range(1,n):
  for j in range(i):
    list1 = x_array[i]
    list2 = x_array[j]
    count = 0
    for k in range(len(list1)):
      count += (list1[k]-list2[k]) ** 2

    if math.sqrt(count) == int(math.sqrt(count)):
      ans += 1

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
N, D = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(N)]
import numpy as np
def dist(X, Y, D):
    s = 0
    for i in range(D):
        s += (X[i] - Y[i]) * (X[i] - Y[i])
    sq = int(np.sqrt(s))
    if np.abs(s - sq * sq) < 0.0001:
        return True
    return False
c = 0
for i in range(N):
    for j in range(i+1, N):
        print("{} {}".format(i, j))
        if dist(data[i], data[j], D):
            c += 1

print("{}".format(c))
        

N, D = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(N)]

import numpy as np
def dist(X, Y, D):
    s = 0
    for i in range(D):
        s += (X[i] - Y[i]) * (X[i] - Y[i])
    sq = np.ceil(np.sqrt(s))
    if np.abs(s - sq * sq) < 0.0001:
        return True
    return False

c = 0
for i in range(N):
    for j in range(i+1, N):
        print("{} {}".format(i, j))
        if dist(data[i], data[j], D):
            c += 1

print("{}".format(c))
  

N, D = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(N)]

import numpy as np
def dist(X, Y, D):
    s2 = 0
    for i in range(D):
        s2 += (X[i] - Y[i]) * (X[i] - Y[i])
    s1 = int(np.sqrt(s2))
    if s2 == s1 * s1:
        return True
    return False

c = 0
for i in range(N):
    for j in range(i+1, N):
        if dist(data[i], data[j], D):
            c += 1
print("{}".format(c))


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
import math

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

n,d = map(int,input().split())
x = []
for i in range(n):
    x.append([int(j) for j in input().split()])
c = 0
print(x)
for i in range(n-1):
    for j in range(i+1,n):
        dist = 0
        for a in range(d):
            dist += (x[i][a] - x[j][a]) * (x[i][a] - x[j][a])
        if is_integer(math.sqrt(dist)):
            c += 1
print(c)

import math

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

n,d = map(int,input().split())
x = []
for i in range(n):
    x.append([int(j) for j in input().split()])
c = 0
for i in range(n-1):
    for j in range(i+1,n):
        dist = 0
        for a in range(d):
            dist += (x[i][a] - x[j][a]) * (x[i][a] - x[j][a])
        if is_integer(math.sqrt(dist)):
            c += 1
print(c)

Verdicts: Wrong Answer

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    L, R = map(int, readline().split())

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

    return


if __name__ == '__main__':
    main()


import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def distance2_nd(p, q):
    return sum((px - qx) ** 2 for px, qx in zip(p, q))


def isqrt(n):
    if n > 0:
        x = 1 << (n.bit_length() + 1) // 2
        y = (x + n // x) // 2
        while y < x:
            x = y
            y = (x + n // x) // 2
        return x
    elif n == 0:
        return 0
    else:
        raise ValueError("isqrt() argument must be nonnegative")


def main():
    N, D = map(int, readline().split())
    X = [list(map(int, readline().split())) for _ in range(N)]

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            d2 = distance2_nd(X[i], X[j])
            di = isqrt(d2)
            if di * di == d2:
                ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
N,D=map(int,input().split())
X = []
for i in range(N):
  X.append(input().split())
c=0
for n in range(0,N-1):
  for m in range(n+1,N):
    a=0
    for j in range(0,D):
      a=a+int((int(X[n][j])-(int(X[m][j])**2)
    if (int(a**(1/2)))**2==a:
      c=c+1
print(c)

n,d=map(int,input().split())
X=[[]*d for i in range(n)]
for i in range(n):
  X[i]=list(map(int,input().split()))
b=0
for i in range(n-1):
  for j in range(i+1,n):
    a=0
    for k in range(d):
      a=a+(X[i][k]-X[j][k])**2
      a=float(a)
    if a**(1/2)==int(a**(1/2)):
      b=b+1
print(b)

Verdicts: Runtime Error

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
n, d = map(int, input().split())
l=[0]*n
for i in range(n):
  l[i] = list(map(int, input().split()))
print(l)

import math
n, d = map(int, input().split())
a = []
ans = 0
x = 0
if d ==1:
  for i in range(n):
    a.append(int(input()))
  for i in range(n):
    for j in range(i,n):
      if math.sqrt((a[i]-a[j])**2)%1==0 and math.sqrt((a[i]-a[j])**2)!=0:
        ans += 1
else:
  for i in range(n):
    a.append(list(map(int, input().split())))
  for i in range(n):
    for j in range(i, n):
      x = 0
      for k in range(d):
        x += (a[i][k] - a[j][k]) **2
      if math.sqrt(x)%1 == 0 and math.sqrt(x) != 0:
        ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
N,D = (int(x) for x in input().split())
X = []*N
for i in range(N):
  X[i] = [float(x) for x in input().split()]
count = 0
for i in range(N-1):
  for j in range(i+1,N):
    sq = [(X[i][k]-X[j][k])**2 for k in range(D)]
    if isinstance(sum(sq)**0.5 , int):
      count += 1
print(count)

N,D = (int(x) for x in input().split())
X = []*N
for i in range(N):
  X[i] = [int(x) for x in input().split()]
count = 0
for i in range(N-1):
  for j in range(i+1,N):
    sq = [(X[i][k]-X[j][k])**2 for k in range(D)]
    if isinstance(sum(sq)**0.5 , int):
      count += 1
print(count)

N,D = (int(x) for x in input().split())
X = [None]*N
for i in range(N):
  X[i] = [float(x) for x in input().split()]
count = 0
for i in range(N-1):
  for j in range(i+1,N):
    sq = [(X[i][k]-X[j][k])**2 for k in range(D)]
    dist = sum(sq)**0.5
    if dist == int(dist):
      count += 1
print(count)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
import math
n, d= (int(c) for c in input().split())

x = []

for i in range(n): 
    x.append(input().split())

sum_ans = 0
count=0
for j in range(0,n):
    for k in range(j+1,n):
        for n in range(d):
            sum_ans = sum_ans+(x[j][n] - x[k][n]) **2
        if math.sqrt(sum_ans)%1==0:
            count=count+1
        sum_ans=0
print(sum_ans)

import math
n, d= (int(c) for c in input().split())

x = []

for i in range(n): 
    x.append(input().split())

sum_ans = 0
count=0
for j in range(0.n-2):
    for k in range(j+1.n-1):
        for n in range(d):
            sum_ans = sum_ans+(x[j][n] - x[k][n]) **2
        if math.sqrt(sum_ans)%1==0:
            count=count+1
        sum_ans=0
print(sum_ans)


import math
n, d= (int(c) for c in input().split())

x = []

for i in range(n): 
    x.append(input().split())

sum_ans = 0
count=0
for j in range(0,n):
    for k in range(j+1,n-1):
        for n in range(d):
            sum_ans = sum_ans+(x[j][n] - x[k][n]) **2
        if math.sqrt(sum_ans)%1==0:
            count=count+1
        sum_ans=0
print(sum_ans)

import math
n, d= (int(c) for c in input().split())

x = []

for i in range(n): 
    x.append(input().split())

sum_ans = 0
count=0
for j in range(0,n-1):
    for k in range(j+1,n-1):
        for n in range(d):
            sum_ans = sum_ans+(x[j][n] - x[k][n]) **2
        if math.sqrt(sum_ans)%1==0:
            count=count+1
        sum_ans=0
print(sum_ans)

import math
n, d= (int(c) for c in input().split())

x = []

for i in range(n): 
    x.append(input().split())

sum_ans = 0
count=0
print
for j in range(0,n-1):
    for k in range(j+1,n):
        for l in range(d):
            sum_ans = sum_ans+(int(x[j][l]) - int(x[k][l])) **2
        if math.sqrt(sum_ans)%1==0.0:
            count=count+1
        sum_ans=0
print(count)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
n,d = map(int,input().split())
s = [input().split() for m in range(n)]
print(s)
b = 0
for m in range(n):
    for l in range(m+1,n):
        ans = 0
        for j in range(d):
            ans += (int(s[m][j])-int(s[l][j]))**2
            if ans**0.5 == int(ans**0.5):
                b += 1
print(b)

n,d = map(int,input().split())
s = [input().split() for i in range(n)]
print(s)
b = 0
for l in range(n):
    for m in range(l+1,n):
        ans = 0
        for j in range(d):
            ans += (int(s[l][j])-int(s[m][j]))**2
        if ans**0.5 == int(ans**0.5):
            b += 1
print(b)

, D = list(map(int,input().split()))
X = []
for i in range(N):
    X.append(list(map(int,input().split())))
#print(X)
count = 0
for i in range(0,N,1):
    for j in range(i+1,N,1):
        wa = 0
        for k in range(D):
            wa += (X[i][k] - X[j][k])**2
        if wa**0.5 == int(wa**0.5):
            count += 1
print(count)

N, D = list(map(int,input().split()))
X = []
for i in range(N):
    X.append(list(map(int,input().split())))
#print(X)
count = 0
for i in range(0,N,1):
    for j in range(i+1,N,1):
        wa = 0
        for k in range(D):
            wa += (X[i][k] - X[j][k])**2
        if wa**0.5 == int(wa**0.5):
            count += 1
print(count)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
import math
N, D = map(int, input().split())
for i in range(N):
    x = list(map(int, input().split()))

cnt = 0
for i in range(D):
    for j in range(i+1, D):
        tmp = 0.0
        for k in range(D):
            tmp += (x[i][k]-x[j][k])**2
        if(math.sqrt(tmp).is_integer()):
            cnt += 1
print(cnt)

import math
N, D = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(N)]

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        tmp = 0
        for k in range(D):
            tmp+=(x[i][k]-x[j][k])**2
        if(math.sqrt(tmp).is_integer()):
            cnt += 1
print(cnt)

Verdicts: Runtime Error

Accepted
Problem: There are N points in a D-dimensional space.  The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).  The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.  How many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?

Submission attempts (in order):
N,D=map(int,input().split())
P=[list(map(int,input().split())) for i in range(D)]

def distance(a,b):
    result=0
    for i in range(D):
        result+=(a[i]-b[i])**2
    result=result**0.5
    return result

ans=0
for i in range(N-1):
    for j in range(i+1,N):
        if distance(P[i],P[j]).is_integer():
            ans+=1

print(ans)

N,D=map(int,input().split())
P=[list(map(int,input().split())) for i in range(N)]

def distance(a,b):
    result=0
    for i in range(D):
        result+=(a[i]-b[i])**2
    result=result**0.5
    return result

ans=0
for i in range(N-1):
    for j in range(i+1,N):
        if distance(P[i],P[j]).is_integer():
            ans+=1

print(ans)

Verdicts: Runtime Error

Accepted
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())

# max_loop = 2019 * 2 + 1
max_loop = 2019 ** 2
count = 0
a = []
for i in range(L, R + 1):
    print(i)
    if count > max_loop:
        break
    a.append(i % 2019)
    count += 1

# print(a)
mn = min(a[:-1])
if mn == 2018:
    print(0)
else:
    ans = (mn * (mn + 1)) % 2019
    print(ans)


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

# max_loop = 2019 * 2 + 1
max_loop = 10 ** 7
count = 0
a = []
for i in range(L, R + 1):
    print(i)
    if count > max_loop:
        break
    a.append(i % 2019)
    count += 1

# print(a)
mn = min(a[:-1])
if mn == 2018:
    print(0)
else:
    ans = (mn * (mn + 1)) % 2019
    print(ans)


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

# max_loop = 2019 * 2 + 1
max_loop = 2019 ** 2
count = 0
ans = 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = (i * j) % 2019
        ans = min(ans, x)
        if ans == 0:
            print(0)
            exit()
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
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 i in range(l,r+1):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)
print(ans)

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%2019*j%2019)%2019)
print(ans)

l, r = map(int, input().split())
# r = min(r, l + MOD - 1)
MOD=2019

if l > 2019:
    l=l%2019+2019

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


# print(l,r)
# exit()

def main():
    res = MOD - 1
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i % MOD) * (j % MOD) % MOD)
    print(res)
 
if __name__ ==  '__main__':
    main()

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

MOD = 2019
r = min(r, l + MOD - 1)

res = MOD - 1
for i in range(l, r):
    for j in range(i + 1, r + 1):
        res = min(res, (i % MOD) * (j % MOD) % MOD)
print(res)



Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
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())

ans = 0
min_mod = 2019

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

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

ans = 0
min_mod = 2019

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

    print("min_mod:",min_mod)
    ans = min_mod
    
print(ans)

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

ans = 0
min_mod = 2019

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

          if min_mod > (i*j) % 2019:
            min_mod = (i*j) % 2019
      
    
    ans = min_mod
    
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
import sys

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

ans = 2020
for i in range(l, r+1):
	for k in range(i, r+1):
		mod = (i * k) % 2019
	if mod==0:
		print(0)
		sys.exit()

	ans = min(mod, ans)
 
print(ans)

import sys

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

ans = 2020
for i in range(l, r+1):
	for k in range(i+1, r+1):
		mod = (i * k) % 2019
		if mod==0:
			print(0)
			sys.exit()

		ans = min(mod, ans)
 
print(ans)

Verdicts: Wrong Answer

Accepted
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):
a, b = map(int, input().split())
ans = 0
a = a % 2019
b = b % 2019

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

print(ans)

a, b = map(int, input().split())
ans = 20000000
n = a//2019
m = b//2019
a = a % 2019
b = b % 2019

if a > b:
    ans = 0
else:
    for i in range(a, b):
        for j in range(a+1, b+1):
            ans = min(ans, i*j%2019)
if m != n:
    ans = 0

if a == b:
    ans = 0

print(ans)

Verdicts: Wrong Answer

Accepted
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())

x = (R - L)%2019
L %= 2019
R = L + x

print(L,R)

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



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

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



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

x = (R - L)%2019
L %= 2019
R = L + x

print(L,R)

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

if L == 0 or R == 0:
  m = 0

print(m)
    



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

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

print(ans)
    
#332701087 1753412895


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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())
a=R-L
Y=2019
if a<2019:
  for i in range(L,R+1):
    for j in range(L,R+1):
      if Y>(i)%2019 and i!=j:
        Y= (i)%2019
  print(Y)
else:
  print(0)
    

l,r=map(int,input().split())
hantei=20202
if r-l+1>=2019:
  print(0)
else:
  for i in range(l,r+1):
    for j in range(l,r+1):
      if i!=j and (i*j)%2019<hantei:
        hantei=(i*j)%2019
  print(hantei)

Verdicts: Wrong Answer

Accepted
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):
n, m = map(int, input().split())
lr = [list(map(int,input().split())) for _ in range(m)]
min2 = 1
max2= n

for llrr in lr:
  min2 = max(min2, llrr[0])
  max2 = min(max2, llrr[1])

if max2-min2 >= 0:
  print(max2-min2+1)
else:
  print(0)

#!/usr/bin/env python3
import sys

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R-L >= 2018:
        print(0)
        return 
    
    lr_all = list(range(L,R+1))
    answer = 2019
    for i in range(R-L+1):
        for j in range(i+1,R-L+1):
            answer = min(lr_all[i]*lr_all[j]%MOD,answer)
    
    print(answer)

    return


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()


Verdicts: Runtime Error

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

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

Verdicts: Runtime Error

Accepted
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())

p, q = L%2019, R%2019
z = R - L

if (p == 0) or (q == 0) or (z > 2019) or (p >= q):
    print(0)
else:
    answer = []
    for i in range(z):#669
        for j in range(z-i):#669-i
            k1 = p + i#3
            k2 = j + i + 1
            X = k1 * k2 % 2019
            if X == 0:
                print(i,j,X)
            answer.append(X)
    A = min(answer, key=int)
    print(A)

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

p, q = L%2019, R%2019
z = R - L

if (p == 0) or (q == 0) or (z > 2019) or (p >= q):
    print(0)
else:
    answer = []
    for i in range(z):#669
        for j in range(z-i):#669-i
            k1 = p + i#3
            k2 = j + k1 + 1
            X = k1 * k2 % 2019
            answer.append(X)
    A = min(answer, key=int)
    print(A)

Verdicts: Wrong Answer

Accepted
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())
 
ans = 2019
m = []
for i in range(L,R+1):
	m.append(i%2019)

for i in range(len(m)):
	for j in range(i+1,len(m)):
		tmp = (m[i]*m[j])%2019
		if ans> tmp:
			ans = tmp
		if tmp = 0:
			break				
print(ans)

L,R = map(int,input().split())
 
ans = 2019
m = []
l = R-L+1
if l < 2019:
	for i in range(L,R+1):
		m.append(i%2019)
else:
	for i in range(L,L+2019):
		m.append(i%2019)

for i in range(len(m)):
	for j in range(i+1,len(m)):
		tmp = (m[i]*m[j])%2019
		if ans> tmp:
			ans = tmp
		if tmp == 0:
			break				
print(ans)

Verdicts: Runtime Error

Accepted
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):
m, n = map(int, input().split(" "))
if n - m >= 673:
    print(0)
else:
    score = m * n % 2019
    for i in range(n, m + 1):
        for j in range(i + 1, n + 1):
            if i * j % 2019 < score:
                score = i * j % 2019
    print(score)


m, n = map(int, input().split(" "))
if n - m >= 673:
    print(0)
else:
    score = m * n % 2019
    for i in range(m, n + 1):
        for j in range(i + 1, n + 1):
            if (i * j) % 2019 < score:
                score = (i * j) % 2019
    print(score)


Verdicts: Wrong Answer

Accepted
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())

if (r-l)>=2019:
    print("0")
else:
    if (l % 2019) < (r % 2019):
        ans= l * r % 2019
        print(int(ans))
    else:
        print("0")

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

ans=2018*2017
for i in range(l,min(r,l+2019)):
    for j in range(i+1,min(r,l+2019)+1):
        ans=min(ans,(i*j) % 2019)
print(int(ans))


Verdicts: Wrong Answer

Accepted
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):
lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2020
for i in range(l, r+1):
  if i==0:
    print(0)
    break
    
  j = i+1
  while j>i and j<=r:
    q = (i*j)%2019
    j = j + (2018-q)//i
    mini = min(mini, q)
    
print(mini)


print(0)

lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2018

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

    if mini==0:
      break
  if mini==0:
    break
print(mini)


lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2020
for i in range(l, r+1):
  j = i+1
  while j>i and j<=r:
    q = (i*j)%2019
    j = j + (2018-q)//i
    mini = min(mini, q)
    
print(mini)


lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2018

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

    if mini==0:
      break
  if mini==0:
    break
print(mini)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted
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(' '))
if R - L >= 2019:
  print(0)
else:
  MIN = flaot('inf')
  for i in range(L,R):
    for j in range(i,R+1):
      MIN = min(MIN,(j-i) % 2019)
print(MIN)

L,R = map(int,input().split(' '))
if R - L >= 2019:
  print(0)
  exit()
else:
  MIN = float('inf')
  for i in range(L,R):
    for j in range(i+1,R+1):
      MIN = min(MIN,(j*i) % 2019)
  print(MIN)

Verdicts: Runtime Error

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

L, R = map(int, input().split())
if R-L >= 2019:
    print(0)
else:
    ans = 2018**2
    for i in range(L, R):
        for j in range(i+1, R+1):
            mod2019 = i*j%2019
            if mod2019 < ans:
                ans = mod2019
    print(ans)

Verdicts: Wrong Answer

Accepted
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):
if __name__ == '__main__':
    l,r  = list(map(int, input().split(" ")))
    res = 2019
    n = l // 2019
    if l % 2019 == 0:
        print(0)
    elif l//(n+1) <= 2019  and 2019 <= r//(n+1):
        print(0)
    else:
        for i in range(2019):
            for j in range(2019):
                if l + i + j > r:
                    break
                res1 = (((l+i) % 2019) * ((l+j+i) % 2019)) % 2019
                if res1 < res:
                    res = res1
        print(res)


if __name__ == '__main__':
    l,r  = list(map(int, input().split(" ")))
    res = 0
    n = l // 2019
    if l % 2019 == 0:
        print(0)
    elif l//(n+1) <= 2019  and 2019 <= r//(n+1):
        print(0)
    else:
        for i in range(2019):
            if l + i + 1 > r:
                break
            res1 = (((l+i) % 2019) * ((l+1+i) % 2019)) % 2019
            res1 < res
            res = res1
        print(res)


if __name__ == '__main__':
    l,r  = list(map(int, input().split(" ")))
    res = 2019
    n = l // 2019
    if l % 2019 == 0:
        print(0)
    elif l//(n+1) <= 2019  and 2019 <= r//(n+1):
        print(0)
    else:
        for i in range(2019):
            if l + i + 1 > r:
                break
            res1 = (((l+i) % 2019) * ((l+1+i) % 2019)) % 2019
            res1 < res
            res = res1
        print(res)


if __name__ == '__main__':
    l,r  = list(map(int, input().split(" ")))
    res = 2019
    n = l // 2019
    if l % 2019 == 0:
        print(0)
    elif l//(n+1) <= 2019  and 2019 <= r//(n+1):
        print(0)
    else:
        for i in range(2019):
            for j in range(i+1, 2019):
                if l+i > r or j+l > r:
                    break
                res1 = (((l+i) % 2019) * (l+j % 2019)) % 2019
                if res1 < res:
                    res = res1
        print(res)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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())
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)

L,R=map(int,input().split())
mod=2019
A=L%mod
B=R%mod
if A==0 or L+2019-A>=R:
    print(0)
else:
    print(A*((L+1)%mod)%mod)

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,i*j%mod)
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
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):
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)

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:
          print(0)
        	exit()   
print(cnt)


s = input().rstrip().split(' ')
L = int(s[0])
R = int(s[1])
cnt = 2020
 
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)

Verdicts: Runtime Error

Runtime Error

Accepted
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())
if R - L >= 2019 :
    print(0)

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

L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)
list = []
else :
    for i in range(L, R+1):
    k = i % 2019
    list.append(k)
    k = 0
list_sort = sorted(list())
l = list_sort[0] * list_sort[1]
print(l % 2019)


L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)
list = []
else :
    for i in range(L, R+1):
    list.append(i % 2019)
list_sort = sorted(list)
l = list_sort[0] * list_sort[1]
print(l % 2019)


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

L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)

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


L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)

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


L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)
list = []
else :
    for i in range(L, R+1):
    k = i % 2019
    list.append(k)
    k = 0
list_sort = sorted(list)
l = list_sort[0] * list_sort[1]
print(l % 2019)

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


L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)
list = []
else :
    for i in range(L, R+1):
    list.append(i % 2019)
list_sort = sorted(list)
l = list_sort[0] * list_sort[1]
print(l % 2019)


L, R = map(int, input().split())
if R - L >= 2018 :
    print(0)
list = []
else :
    for i in range(L, R+1):
    k = i % 2019
    list.append(k)
    k = 0
list_sort = sorted(list())
l = list_sort[0] * list_sort[1]
print(l % 2019)


L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
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 = int(input().split())
if R-L > 2019:
    print(0)
else:
    ans = (L*(L+1))%2019
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans = min(ans,(i%2019)*(j%2019))
    print(ans)

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

Verdicts: Runtime Error

Accepted
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):
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    l, r = map(int, input().split())
    print(l, r)
    if l % 2019 == 0 or r % 2019 == 0:
        ans = 0
    else:
        i = min(sorted(divisor(l)))
        j = min(sorted(divisor(r)))
        ans = (i+1) * (j)
    print(ans)


if __name__ == "__main__":
    main()


def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    l, r = map(int, input().split())
    ans = float("inf")
    if r - l >= 2500:
        ans = 0
    else:
        for i in range(l, r):
            for j in range(i+1, r+1):
                ans = min((i*j % 2019), ans)
    print(ans)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

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

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

import sys
l,r = map(int,input().split())
mn = 2018
for i in range(l,r+1):
    for j in range(i+1,r+1):
        mod = (i * j) % 2019
        if mod == 0:
            print(0)
            sys.exit()
        
        mn = min(mn,mod)
print(mn)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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 = [int(elem) for elem in input().split()]

res = 0
if (r / 2019) - (l / 2019) < 1:
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            tmp = (i * j) % 2019
            if tmp < res:
                res = tmp
            elif i == l:
                res = tmp
    print(res)
else:
    print(0)

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

res = -1
if (r / 2019) - (l / 2019) < 1:
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            tmp = (i * j) % 2019
            if tmp < res:
                res = tmp
            elif res == -1:
                res = tmp
    print(res)
else:
    print(0)

Verdicts: Wrong Answer

Accepted
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())
mod = 2019
modlist = [(L + i)%mod for i in range(min(2019,R-L+1))]
print(modlist)
length = len(modlist)
ans = 2019
for i in range(length):
    for j in range(i+1,length):
        ans = min(ans, modlist[i]*modlist[j]%mod)

print(ans)

L, R = map(int, input().split())
mod = 2019
modlist = [(L + i)%mod for i in range(min(2019,R-L+1))]
length = len(modlist)
ans = 2019
for i in range(length):
    for j in range(i+1,length):
        ans = min(ans, modlist[i]*modlist[j]%mod)

print(ans)

Verdicts: Wrong Answer

Accepted
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):
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))


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

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


Verdicts: Runtime Error

Accepted