Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

N=int(input())
A=list(map(int,input().split()))
B=[A[i]-A[i-1] for i in range(1,N)]

ans=0
first=B[0]
for i in range(N-1):
    if first*B[i]>=0:
        pass
    else:
        ans+=1
        if i+1<=N-2:
            first=B[i+1]

print(ans+1)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
if N==1:
    print(1)
    exit()

B=[A[i]-A[i-1] for i in range(1,N)]
ans=0
flag=False
for i in range(N-1):
    if B[i]!=0:
        first=B[i]
        flag=True
    if flag:
        break
for i in range(N-1):
    if first*B[i]>=0:
        pass
    else:
        ans+=1
        j=i+1
        while j<=N-2:
            if B[j]!=0:
                first=B[j]
                break
            else:
                j+=1

print(ans+1)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
ans=0
while True:
    if M>=2 and N>=1:
        ans+=1
        N-=1
        M-=2
    elif M>=4:
        ans+=1
        M-=4
    else:
        break
print(ans)


Fixed submission:
N,M=map(int,input().split())
ans=0

if M>=2*N:
    ans+=N
    M-=2*N
    ans+=M//4
    print(ans)
    exit()
else:
    ans+=M//2
    print(ans)
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k==S:
                ans+=1
print(ans)

Fixed submission:
K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        k=S-i-j
        if 0<=k and k<=K:
            ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

if a>0 and b>0:
  print('Positive')
  exit()
elif a=0 or b=0:
  print('Zero')
  exit()
elif a<0 and 0<b:
  if abs(a)%2==0:
    print('Positive')
   	exit()
  else:
    print('Negative')
    exit()
else:
  if abs(b-a)%2==0:
    print('Negative')
    exit()
  else:
    print('Positive')
    exit()

  

Fixed submission:
a,b=map(int,input().split())

if a>0 and b>0:
    print('Positive')
    exit()

elif a<=0 and 0<=b:
    print('Zero')
    exit()
else:
    if abs(b-a)%2==0:
        print('Negative')
        exit()
    else:
        print('Positive')
        exit()
Buggy python submission (verdict: Runtime Error):
t=int(input())
if(t==1):
  print(0)
else:
  print(1)/

Fixed submission:
t=int(input())
if(t==1):
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
str1=input()
ct=0
for i in range(0,3):
  if(str1[i]=='S')
  ct+=1
if(ct==0):
  print(3)
if(ct==3):
  print(0)
if(ct==2):
  print(1)
if(ct==1):
  if(str1[1]=='S'):
    print(1)
  else:
    print(2)

Fixed submission:
str1=input()
ct=0
for i in range(0,3):
    if(str1[i]=='S'):
        ct+=1
if(ct==0):
    print(3)
if(ct==3):
    print(0)
if(ct==2):
    print(1)
if(ct==1):
    if(str1[1]=='S'):
        print(1)
    else:
        print(2)
Buggy python submission (verdict: Time Limit Exceeded):
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      arr.append([i, cnt])

  if temp!=1:
    arr.append([temp, 1])

  if arr==[]:
    arr.append([n, 1])

  return arr

def resolve():
  N = int(input())
  count = 1

  for c in range(1, N-1):
    factorized = factorization(N-c)
    num_of_pattern = 1
    even_flag = True
    
    for segment in factorized:
      num_of_pattern *= segment[1] + 1

      if segment[1] % 2 == 1:
        even_flag = False

    count += num_of_pattern

  print(count)

if __name__ == "__main__":
  resolve()

Fixed submission:
def resolve():
  N = int(input())
  count = 0

  for A in range(1, N):
    count += ((N-1)//A)
  print(count)

if __name__ == "__main__":
  resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
  N, X, M = map(int, input().split(" "))
  checked = [False] * M
  val = X
  ans = val
  val_list = [val]
  checked[val] = val

  base = M
  for i in range(N-1):
    val*=val
    if val >= base:
      val %= base

    if checked[val] != False:
      loop_start_index = checked[val]+1

      loop_val = sum(val_list[loop_start_index:])
      loop_length = len(val_list[loop_start_index:])
      
      ans += ((N - i - 1) // loop_length) * loop_val
      segment = val_list[loop_start_index:loop_start_index + ((N - i - 1) % loop_length) ]
      ans += sum(segment)
      break
    ans += val
    checked[val] = i
    val_list.append(val)


  print(ans)

if __name__ == "__main__":
  resolve()

Fixed submission:

def resolve():
  N, X, M = map(int, input().split(" "))
  checked = [False] * M
  val = X
  ans = 0
  val_list = []

  base = M
  for i in range(N):
    if checked[val] != False:
      loop_start_index = checked[val]
      loop_vals = val_list[loop_start_index:]
      loop_val = sum(loop_vals)
      loop_length = len(val_list[loop_start_index:])
      
      if loop_length != 0:
        ans += ((N - i) // loop_length) * loop_val

        for i in range(((N - i) % loop_length)):
          ans += loop_vals[i]
      break
    ans += val
    checked[val] = i
    val_list.append(val)

    val*=val
    if val >= base:
      val %= base


  print(ans)

if __name__ == "__main__":
  resolve()
Buggy python submission (verdict: Time Limit Exceeded):
import math

def resolve():
  N = int(input())

  for n in range(1, N+1):
    count = 0
    max_range = int(math.sqrt(n)) + 1
    for x in range(1, max_range):
      for y in range(1, max_range):
        for z in range(1, max_range):
          if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
            count += 1
    print(count)

if __name__ == "__main__":
  resolve()


Fixed submission:
import math

def resolve():
  N = int(input())

  result = [0] * (N + 1)
  max_range = int(math.sqrt(N)) + 1
  for x in range(1, max_range):
    for y in range(1, max_range):
      for z in range(1, max_range):
        index = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if index <= N:
          # if index == 8:
          #   print("x: {0}, y: {1},z: {2},".format(x, y, z))
          result[index] += 1

  for i in result[1:]:
    print(i)

if __name__ == "__main__":
  resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
  N = int(input())
 
  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i
 
  # print(table)  
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 
if __name__ == "__main__":
  resolve()
def resolve():
  N = int(input())

  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i

  # print(table)  
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]

  print(ans)

if __name__ == "__main__":
  resolve()

Fixed submission:
def resolve():
  N = int(input())
 
  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i
 
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 

if __name__ == "__main__":
  resolve()

Buggy python submission (verdict: Time Limit Exceeded):

def resolve():
  N = int(input())

  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i

  # print(table)  
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]

  print(ans)

if __name__ == "__main__":
  resolve()

Fixed submission:
def resolve():
  N = int(input())
 
  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i
 
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 

if __name__ == "__main__":
  resolve()
Buggy python submission (verdict: Time Limit Exceeded):

from collections import Counter

def resolve():
  N = int(input())
  countA = Counter([int(x) for x in input().split(" ")])
  Q = int(input())

  sum_A = 0
  for a in countA.keys():
    sum_A += a*countA[a]

  for _ in range(Q):
    B, C = map(int, input().split(" "))
    if B in countA.keys():
      countA[C] += countA.pop(B)
      sum_A = 0
      for a in countA.keys():
        sum_A += a*countA[a]
      print(sum_A)
    else:
      print(sum_A)


if __name__ == "__main__":
  resolve()

Fixed submission:
from collections import Counter

def resolve():
  N = int(input())
  countA = Counter([int(x) for x in input().split(" ")])
  Q = int(input())

  sum_A = 0
  for a in countA.keys():
    sum_A += a*countA[a]

  for _ in range(Q):
    B, C = map(int, input().split(" "))
    if B in countA.keys():
      target_value = countA.pop(B)
      sum_A += (C - B) * target_value
      countA[C] += target_value
      print(sum_A)
    else:
      print(sum_A)


if __name__ == "__main__":
  resolve()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

def resolve():
  N = int(input())
  countA = Counter([int(x) for x in input().split(" ")])
  Q = int(input())

  sum_A = 0
  for a in countA.items():
    sum_A += a[0]*a[1]

  for _ in range(Q):
    B, C = map(int, input().split(" "))
    if B in countA.keys():
      countA[C] += countA.pop(B)
      sum_A = 0
      for a in countA.items():
        sum_A += a[0]*a[1]
      print(sum_A)
    else:
      print(sum_A)


if __name__ == "__main__":
  resolve()


Fixed submission:
from collections import Counter

def resolve():
  N = int(input())
  countA = Counter([int(x) for x in input().split(" ")])
  Q = int(input())

  sum_A = 0
  for a in countA.keys():
    sum_A += a*countA[a]

  for _ in range(Q):
    B, C = map(int, input().split(" "))
    if B in countA.keys():
      target_value = countA.pop(B)
      sum_A += (C - B) * target_value
      countA[C] += target_value
      print(sum_A)
    else:
      print(sum_A)


if __name__ == "__main__":
  resolve()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  Q = int(input())

  countA = Counter(A)

  for _ in range(Q):
    B, C = map(int, input().split(" "))
    if B in countA.keys():
      countA[C] += countA.pop(B)
    sum_A = 0
    for a in countA.items():
      sum_A += a[0]*a[1]
    print(sum_A)

if __name__ == "__main__":
  resolve()


Fixed submission:
from collections import Counter

def resolve():
  N = int(input())
  countA = Counter([int(x) for x in input().split(" ")])
  Q = int(input())

  sum_A = 0
  for a in countA.keys():
    sum_A += a*countA[a]

  for _ in range(Q):
    B, C = map(int, input().split(" "))
    if B in countA.keys():
      target_value = countA.pop(B)
      sum_A += (C - B) * target_value
      countA[C] += target_value
      print(sum_A)
    else:
      print(sum_A)


if __name__ == "__main__":
  resolve()
Buggy python submission (verdict: Runtime Error):
# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8

def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      arr.append([i, cnt])

  if temp!=1:
    arr.append([temp, 1])

  if arr==[]:
    arr.append([n, 1])

  return arr

def resolve():
  N = int(input())
  prime_factors = factorization(N)

  result = 0
  for prime_factor in prime_factors:
    if prime_factor[0] == 1:
      continue

    for count in range(2, 42):
      if prime_factor[1] < (count + 1)*count//2:
        result += count - 1
        break
  print(result)


if __name__ == "__main__":
  resolve()

Fixed submission:
import numpy as np
import math
from decimal import Decimal

def resolve():
  S = input().split(" ")
  print(math.floor(int(S[0])*Decimal(S[1])))


if __name__ == "__main__":
  resolve()

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
from decimal import Decimal

def resolve():
  S = input().split(" ")
  # print(math.floor(int(S[0])*Decimal(S[1])))
  # print(math.floor((int(S[0]) * int(float(S[1])*100))) // 100)
  print(math.floor((int(A) * int(float(B)*100))) // 100)
# if __name__ == "__main__":
#   resolve()

if __name__ == "__main__":
  resolve()

Fixed submission:
import numpy as np
import math
from decimal import Decimal

def resolve():
  S = input().split(" ")
  print(math.floor(int(S[0])*Decimal(S[1])))


if __name__ == "__main__":
  resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
  S = input().split(" ")
  A = int(S[0])
  B = float(S[1])
  B = int(B * 100)
  if A == 0 or B == 0:
    print(0)
    return True
  AB = np.asarray([A, B], dtype = np.uint64)
  # print("{:17}".format(AB[0]*AB[1]).replace(" ", "").replace(".0", ""))
  # result = str(AB[0]*AB[1])
  print(A*B//100)

  # if len(result) > 2:
  #   print(result[:-2])
  # else:
  #   print(0)

if __name__ == "__main__":
  resolve()


Fixed submission:
import numpy as np
import math
from decimal import Decimal

def resolve():
  S = input().split(" ")
  print(math.floor(int(S[0])*Decimal(S[1])))


if __name__ == "__main__":
  resolve()
Buggy python submission (verdict: Runtime Error):

def resolve():
  N = int(input())
  prime_factors = factorization(N)
  tri_dict = {
    1 :  1,
    2 :  1,
    3 :  2 ,
    4 :  2 ,
    5 :  2 ,
    6 :  3 ,
    7 :  3 ,
    8 :  3 ,
    9 :  3 ,
    10 :  4 ,
    11 :  4 ,
    12 :  4 ,
    13 :  4 ,
    14 :  4 ,
    15 :  5 ,
    16 :  5 ,
    17 :  5 ,
    18 :  5 ,
    19 :  5 ,
    20 :  5 ,
    21 :  6 ,
    22 :  6 ,
    23 :  6 ,
    24 :  6 ,
    25 :  6 ,
    26 :  6 ,
    27 :  6 ,
    28 :  7 ,
    29 :  7 ,
    30 :  7 ,
    31 :  7 ,
    32 :  7 ,
    33 :  7 ,
    34 :  7 ,
    35 :  7 ,
    36 :  8 ,
    37 :  8 ,
    38 :  8 ,
    39 :  8 ,
    40 :  8
  }
  result = 0

  for prime_factor in prime_factors:
    if prime_factor[0] > 1:
      result += tri_dict[prime_factor[1]]

  print(result)
 
if __name__ == "__main__":
    resolve()

Fixed submission:
# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8

def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      arr.append([i, cnt])

  if temp!=1:
    arr.append([temp, 1])

  if arr==[]:
    arr.append([n, 1])

  return arr

def resolve():
  N = int(input())
  prime_factors = factorization(N)
  tri_dict = {
    1 :  1,
    2 :  1,
    3 :  2,
    4 :  2,
    5 :  2,
    6 :  3,
    7 :  3,
    8 :  3,
    9 :  3,
    10 :  4,
    11 :  4,
    12 :  4,
    13 :  4,
    14 :  4,
    15 :  5,
    16 :  5,
    17 :  5,
    18 :  5,
    19 :  5,
    20 :  5,
    21 :  6,
    22 :  6,
    23 :  6,
    24 :  6,
    25 :  6,
    26 :  6,
    27 :  6,
    28 :  7,
    29 :  7,
    30 :  7,
    31 :  7,
    32 :  7,
    33 :  7,
    34 :  7,
    35 :  7,
    36 :  8,
    37 :  8,
    38 :  8,
    39 :  8,
    40 :  8,
    41 :  8,
    42 :  8,
    43 :  8,
    44 :  8,
    45 :  9,
    46 :  9,
    47 :  9,
    48 :  9,
    49 :  9,
    50 :  9,
    51 :  9,
    52 :  9,
    53 :  9,
    54 :  9,
    55 :  9,
    56 :  9,
    57 :  9,
    58 :  9,
    59 :  9
  }
  result = 0

  for prime_factor in prime_factors:
    if prime_factor[0] > 1:
      result += tri_dict[prime_factor[1]]

  print(result)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
  N, K = map(int, input().split(" "))
  A = [int(x) - 1 for x in input().split(" ")]

  history = []
  current = 0
  if K < N:
    for i in range(K):
      current = A[current]
    print(current + 1)
    return True
  else:
    while True:
      history.append(current)
      current = A[current]
      if current in history:
        loop_length = len( history[history.index(current):] )
        if loop_length == 0:
          print(current + 1)
          return True

        length_to_loop = len( history[:history.index(current)] )
        additional_way = (K-length_to_loop)%loop_length
        print(history[length_to_loop + additional_way] + 1)
        return True

if __name__ == "__main__":
    resolve()

Fixed submission:
def resolve():
  N, K = map(int, input().split(" "))
  A = [int(x) - 1 for x in input().split(" ")]

  current = 0
  if K < N:
    for i in range(K):
      current = A[current]
    print(current + 1)
    return True
  else:
    history = [False] * N
    load_map = []
    while True:
      load_map.append(current)
      current = A[current]
      if history[current]:
        loop_length = len( load_map[load_map.index(current):] )
        if loop_length == 0:
          print(current + 1)
          return True

        length_to_loop = len( load_map[:load_map.index(current)] )
        additional_way = (K-length_to_loop)%loop_length
        print(load_map[length_to_loop + additional_way] + 1)
        return True
      else:
        history[current] = True

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
  N, M = map(int, input().split(" "))
  H = [int(x) for x in input().split(" ")]

  AB = []
  for i in range(M):
    AB.append([int(x) for x in input().split(" ")])

  result = []
  for h_index in range(1, N+1):
    if len(AB) == 0:
      break

    result.append([])
    for ab in AB:
      if ab[0] == h_index:
        if ab[1] not in result[-1]:
          result[-1].append(ab[1])

      if ab[1] == h_index:
        if ab[0] not in result[-1]:
          result[-1].append(ab[0])

  # print(result)
  count = 0
  for h_index in range(0, N):
    flag = True
    for r in result[h_index]:
      if H[r-1] >= H[h_index]:
        flag = False
        break
    if flag:
      count += 1
  print(count)

if __name__ == "__main__":
    resolve()

Fixed submission:
def resolve():
  N, M = map(int, input().split(" "))
  H = [int(x) for x in input().split(" ")]

  AB = []
  for i in range(M):
    AB.append([int(x)-1 for x in input().split(" ")])

  result = [True] * N
  for ab in AB:
    if H[ab[0]] > H[ab[1]]:
      result[ab[1]] = False
      continue
    if H[ab[1]] > H[ab[0]]:
      result[ab[0]] = False
      continue
    if H[ab[1]] == H[ab[0]]:
      result[ab[0]] = False
      result[ab[1]] = False
      continue

  print(result.count(True))

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def good_or_bad(h, loads, H):
  squeezed_map = []

  for m in loads:
    if h+1 not in m:
      continue

    if H[m[0]-1] > H[h] or H[m[1]-1] > H[h] or H[m[0]-1] == H[m[1]-1]:
      # print(h)
      return False

  return True

def resolve():
  N, M = map(int, input().split(" "))
  H = [int(x) for x in input().split(" ")]

  AB = []
  for i in range(M):
    AB.append([int(x) for x in input().split(" ")])

  result = []
  for ab in AB:
    if ab not in result:
      result.append(ab)
  AB = result

  result = 0
  for h in range(len(H)):
    if good_or_bad(h, AB, H):
      result += 1

  print(result)

if __name__ == "__main__":
    resolve()

Fixed submission:
def resolve():
  N, M = map(int, input().split(" "))
  H = [int(x) for x in input().split(" ")]

  AB = []
  for i in range(M):
    AB.append([int(x)-1 for x in input().split(" ")])

  result = [True] * N
  for ab in AB:
    if H[ab[0]] > H[ab[1]]:
      result[ab[1]] = False
      continue
    if H[ab[1]] > H[ab[0]]:
      result[ab[0]] = False
      continue
    if H[ab[1]] == H[ab[0]]:
      result[ab[0]] = False
      result[ab[1]] = False
      continue

  print(result.count(True))

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]

  results = [str(A.count(i)) for i in range(1, N+1)]

  print('\n'.join(results))

if __name__ == "__main__":
  resolve()


Fixed submission:
from collections import Counter

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  collection = Counter(A)
  for i in range(1, N + 1):
    print(collection[i])
  # results = [str(A.count(i))+'\n' for i in range(1, N+1)]
  # print('\n'.join(results))

if __name__ == "__main__":
  resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]

  results = [A.count(i) for i in range(1, N+1)]

  for result in results:
    print(result)
    
if __name__ == "__main__":
  resolve()

Fixed submission:
from collections import Counter

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  collection = Counter(A)
  for i in range(1, N + 1):
    print(collection[i])
  # results = [str(A.count(i))+'\n' for i in range(1, N+1)]
  # print('\n'.join(results))

if __name__ == "__main__":
  resolve()

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
from functools import reduce
from itertools import product

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]

  results = [A.count(i) for i in range(1, N+1)]

  for result in results:
    print(result)
    
if __name__ == "__main__":
  resolve()

Fixed submission:
from collections import Counter

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  collection = Counter(A)
  for i in range(1, N + 1):
    print(collection[i])
  # results = [str(A.count(i))+'\n' for i in range(1, N+1)]
  # print('\n'.join(results))

if __name__ == "__main__":
  resolve()
Buggy python submission (verdict: Runtime Error):
    N = list(input())
    if ("7" in N):
      print("Yes")
    else:
      print("No")


Fixed submission:
N = list(input())
if ("7" in N):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd_list(numbers):
  return reduce(math.gcd, numbers)


K = int(input())
abc_list = []


for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      abc_list.append([a, b, c])

gcds = [gcd_list(x) for x in abc_list]

print(sum(gcds))

Fixed submission:
import math
from functools import reduce
def gcd_list(numbers):
  return reduce(math.gcd, numbers)

K = int(input())
gcd = 0

for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      gcd += (gcd_list([a, b, c]))

print(gcd)
Buggy python submission (verdict: Runtime Error):
import numpy as np

def mod_2019(L, R):
  year = 2019
  if (R - L) >= year:
    return 0
 
  import numpy as np
  array = np.array([[i for i in range(L, R)]])
  if (array % year).min() == 0:
    return 0
  
  
  array_2d = np.dot(array.T, array)
  for i in range(len(array_2d[0])):
     array_2d[i][i] = year -1
  return (array_2d % year).min()
  

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

print(mod_2019(L, R))

Fixed submission:
N, A, B = (int(i) for i in input().split())
cost = N * A if N * A < B else B
print(cost)

Buggy python submission (verdict: Runtime Error):
import time

def mod_2019(L, R):
  year = 2019
  if (R - L) >= year:
    return 0
 
  import numpy as np
  array = np.array([[i for i in range(L, R)]])
  if (array % year).min() == 0:
    return 0
  
  
  array_2d = np.dot(array.T, array)
  for i in range(len(array_2d[0])):
     array_2d[i][i] = year -1
  return (array_2d % year).min()
  

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

print(mod_2019(L, R))

Fixed submission:
N, A, B = (int(i) for i in input().split())
cost = N * A if N * A < B else B
print(cost)
Buggy python submission (verdict: Runtime Error):
N, _ = (int(i) for i in input().split())
data = [int(int(i) for i in input().split()) for i in range(N)]

import numpy as np
from scipy.spatial import distance

distance = distance.cdist(data, data, metric='euclidean')
count = 0
for n in range(0,N):
  for d in range(n+1,N):
    if distance[n][d].is_integer() and distance[n][d] != 0 :
      count+=1
print(count)

Fixed submission:
N, _ = (int(i) for i in input().split())
data = [[int(i) for i in input().split()] for i in range(N)]

import numpy as np
from scipy.spatial import distance

distance = distance.cdist(data, data, metric='euclidean')
count = 0
for n in range(0,N):
  for d in range(n+1,N):
    if distance[n][d].is_integer() and distance[n][d] != 0 :
      count+=1
print(count)