Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
R = []
max = -10**9
for i in range(n):
    R.append(int(input()))
for i in range(n-1):
    for j in range(i+1, n):
        if R[j] - R[i] > max:
            max = R[j] - R[i]
print(max)



Fixed submission:
max_R = -10**9
for i in range(int(input())):
    if i == 0:
        min_R = int(input())
        continue
    R = int(input())
    if R - min_R > max_R:
        max_R = R - min_R
    if R < min_R:
        min_R = R
print(max_R)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
def insert():
    a.appendleft(command[1])

def delete():
    try:
        a.remove(command[1])
    except ValueError:
        pass

def deleteFirst():
    a.popleft()

def deleteLast():
    a.pop()

n = int(input())
a = deque([])
for i in range(n):
    command = input().split()
    if command[0] == "insert":
        insert()
    elif command[0] == "delete":
        delete()
    elif command[0] == "deleteFirst":
        deleteFirst()
    else:
        deleteLast()

for i, e in enumerate(a):
    if i == len(a) - 1:
        print(e)
    else:
        print(e, end=' ')



Fixed submission:
from collections import deque
a = deque([])
for i in range(int(input())):
    c = input().split()
    if c[0] == "insert":
        a.appendleft(c[1])
    elif c[0] == "delete":
        try:
            a.remove(c[1])
        except ValueError:
            pass
    elif c[0] == "deleteFirst":
        a.popleft()
    else:
        a.pop()
for i,e in enumerate(a):
    if i == len(a) - 1:
        print(e)
    else:
        print(e, end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
def insert():
    a.appendleft(command[1])

def delete():
    try:
        a.remove(command[1])
    except ValueError:
        pass

def deleteFirst():
    a.popleft()

def deleteLast():
    a.pop()

n = int(input())
a = deque([])
for i in range(n):
    command = input().split()
    if command[0] == "insert":
        insert()
    elif command[0] == "delete":
        delete()
    elif command[0] == "deleteFirst":
        deleteFirst()
    else:
        deleteLast()

for i, e in enumerate(a):
    if i == len(a) - 1:
        print(e)
    else:
        print(e, end=' ')



Fixed submission:
from collections import deque
a = deque([])
for i in range(int(input())):
    c = input().split()
    if c[0] == "insert":
        a.appendleft(c[1])
    elif c[0] == "delete":
        try:
            a.remove(c[1])
        except ValueError:
            pass
    elif c[0] == "deleteFirst":
        a.popleft()
    else:
        a.pop()
for i,e in enumerate(a):
    if i == len(a) - 1:
        print(e)
    else:
        print(e, end=" ")
Buggy python submission (verdict: Runtime Error):
n, m, l = map(int, input().split())
A, B = [], []
C = [[0 for i in range(n)] for j in range(l)]

for i in range(n):
    A.append([int(i) for i in input().split()])

for i in range(m):
    B.append([int(i) for i in input().split()])

B = list(zip(*B))

for i, line_A in enumerate(A):
    for j, line_B in enumerate(B):
        for x, y in zip(line_A, line_B):
            C[i][j] += x * y

for line in C:
    for i, x in enumerate(line):
        if i == l - 1:
            print(x)
        else:
            print(x, end=" ")



Fixed submission:
n, m, l = map(int, input().split())
A, B = [], []
C = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    A.append([int(i) for i in input().split()])

for i in range(m):
    B.append([int(i) for i in input().split()])

B = list(zip(*B))

for i, line_A in enumerate(A):
    for j, line_B in enumerate(B):
        for x, y in zip(line_A, line_B):
            C[i][j] += x * y

for line in C:
    for i, x in enumerate(line):
        if i == l - 1:
            print(x)
        else:
            print(x, end=" ")
Buggy python submission (verdict: Runtime Error):
re = open("input")
count = 0
role = {".": True, "@": False, "#": False}
def now(xpoint, ypoint):
    return role[room[ypoint][xpoint]]

def search(xpoint, ypoint):
    global count
    if 0 <= xpoint < wh[0] and 0 <= ypoint < wh[1] and now(xpoint, ypoint):
        count += 1
        room[ypoint][xpoint] = "@"
        search(xpoint - 1, ypoint)
        search(xpoint + 1, ypoint)
        search(xpoint, ypoint + 1)
        search(xpoint, ypoint - 1)

while True:
    wh = map(int, re.readline().split())
    room = []
    count = 0
    for ypoint in range(wh[1]):
        line = re.readline().replace("\n", "")
        if "@" in line:
            xp = line.index("@")
            yp = ypoint
        room.append([x for x in line])
    if not room: break
    room[yp][xp] = "."
    search(xp, yp)
    print count

Fixed submission:
(lambda f:f(f))(lambda T,A=lambda L,yp,ri=lambda l:R.append([{xi:x}for xi,x in enumerate(l)]):[P.__setitem__("x",L.index("@")),P.__setitem__("y",yp),ri(L)]if "@"in L else ri(L),S=lambda X,Y,s,u:[R[Y][X].__setitem__(X,"@"),s(X-1,Y,s,u)+s(X+1,Y,s,u)+s(X,Y+1,s,u)+s(X,Y-1,s,u)+1][1]if 0<=X<W[0]and 0<=Y<W[1]and u(X,Y)else 0,u=lambda X,Y:R[Y][X].get(X)is ".",g=globals:[g().__setitem__("W",list(map(int,input().split()))),g().__setitem__("R",[]),g().__setitem__("P",{"x":9,"y":9}),[A(input(),Y)for Y in range(W[1])],[R[P["y"]][P["x"]].__setitem__(P["x"],"."),print(S(P["x"],P["y"],S,u)),T(T)]if R else 9])
Buggy python submission (verdict: Runtime Error):
#include <iostream>
using namespace std;
int main(void){
    
    int i,n;
    int x[101];
    
    cin >> n;
    
    for(i=0; i<n; i++){
        cin >> x[i];
    }
    
    for(i=n-1; i>=0; i--){
        if (i==0){
            cout << x[i] << endl;
        }
        else{
            cout << x[i] << " ";
        }
    }
    
    cout << endl;
    
    return 0;
}



Fixed submission:
n = int(input())

data = list(map(int, input().split()))

for i in data[::-1]:
  if i == data[0]:
    print(i)
  else:
    print(i,"",end="")
Buggy python submission (verdict: Runtime Error):
cards = [[0 for i in range(13)] for j in range(4)]

pattern = ["S", "H", "C", "D"]

n = int(input())

ch_list=[]
rank_list_0=[]
while n > 0:
  ch, rank = input().split()
  ch_list.append(ch)
  rank_list_0.append(rank)
  n = n - 1

rank_list = [int(rank_list) for rank_list in rank_list_0]

for (chlist, ranklist) in zip(ch_list,rank_list):
      cards[pattern.index(chlist)][ranklist-1] = 1
      
for i in range(0, 3):
  for j in range(0, 12)
    if cards[i][j] == 0:
        print(pattern[i], j+1)
        


Fixed submission:
cards = [[0 for i in range(13)] for j in range(4)]

pattern = ["S", "H", "C", "D"]

n = int(input())

ch_list=[]
rank_list_0=[]
while n > 0:
  ch, rank = input().split()
  ch_list.append(ch)
  rank_list_0.append(rank)
  n = n - 1

rank_list = [int(rank_list) for rank_list in rank_list_0]

for (chlist, ranklist) in zip(ch_list,rank_list):
      cards[pattern.index(chlist)][ranklist-1] = 1
      
for i in range(0, 4):
  for j in range(0, 13):
    if cards[i][j] == 0:
        print(pattern[i], j+1)
Buggy python submission (verdict: Runtime Error):
value = input().split()
print(str(value[0]*value[1])+" "+str((value[0]+value[1])*2)

Fixed submission:
z= input()
x, y = z.split()
 
m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))

Buggy python submission (verdict: Runtime Error):
spam=input().split(' ')
print(' '.join(spam[0] * spam[1], 2*(spam[0]+spam[1])))

Fixed submission:
z= input()
x, y = z.split()
 
m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))

Buggy python submission (verdict: Runtime Error):
spam=input().split(' ')
print(' '.join(spam[0] * spam[1], 2*(spam[0]+spam[1])))
return 0

Fixed submission:
z= input()
x, y = z.split()
 
m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))

Buggy python submission (verdict: Runtime Error):
spam=input().split(' ')
print(' '.join(spam[0] * spam[1], 2*(spam[0]+spam[1])))

Fixed submission:
z= input()
x, y = z.split()
 
m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))
Buggy python submission (verdict: Runtime Error):
import fractions 
A, B, C = [int(k) for k in raw_input().split(' ')]
print((A * B)/ (fractions.gcd(A, B) ** 2 ))



Fixed submission:
import fractions 
A, B, C = [int(k) for k in raw_input().split(' ')]
print(C * ((A * B)/ (fractions.gcd(A, B) ** 2 )))

Buggy python submission (verdict: Runtime Error):
import fractions 
A, B, C = [int(k) for k in raw_input().split(' ')]
print(C * ((A * B)/ (fractions.gcd(A, B) ** 2 )))



Fixed submission:
import fractions 
A, B, C = [int(k) for k in raw_input().split(' ')]
print(C * ((A * B)/ (fractions.gcd(A, B) ** 2 )))
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]

diff = [0] * 100001
for k in l :
    diff[k[0] - 1] += 1
    diff[k[1]] -= 1

hist = [0,0]
for i in range(2, N + 1) :
    hist.append(hist[-1] + diff[i-1])

print(max([y - 1 for (x,y) in zip(hist, range(N + 1)) if x + 1 >= y]))

Fixed submission:
N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]

diff = [0] * 100002
for k in l :
    diff[k[0] - 1] += 1
    diff[k[1]] -= 1

hist = [0,0]
for i in range(2, N + 2) :
    hist.append(hist[-1] + diff[i-1])

print(max([0] + [y - 1 for (x,y) in zip(hist, range(N + 2)) if x + 1 >= y]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]

diff = [0] * 100001
for k in l :
    diff[k[0] - 1] += 1
    diff[k[1]] -= 1

hist = [0,0]
for i in range(2, N + 1) :
    hist.append(hist[-1] + diff[i-1])

print(max([0] + [y - 1 for (x,y) in zip(hist, range(N + 1)) if x + 1 >= y]))

Fixed submission:
N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]

diff = [0] * 100002
for k in l :
    diff[k[0] - 1] += 1
    diff[k[1]] -= 1

hist = [0,0]
for i in range(2, N + 2) :
    hist.append(hist[-1] + diff[i-1])

print(max([0] + [y - 1 for (x,y) in zip(hist, range(N + 2)) if x + 1 >= y]))
Buggy python submission (verdict: Runtime Error):
a = input()
print(a * a * a) 

Fixed submission:
a = input()
a = int(a)
print(a * a * a)
Buggy python submission (verdict: Runtime Error):
import math

r = int(input())

area = math.pi * r * r
circle = 2 * math.pi * r

print("{:.8f} {:.8f}".format(area, circle))



Fixed submission:
import math

r = float(input())

area = math.pi * r * r
circle = 2 * math.pi * r

print("{:.8f} {:.8f}".format(area, circle))
Buggy python submission (verdict: Runtime Error):
H,W,x,y,r = map(int,input().split())

if -r < = y <= H-r :
  if -r < =  x <= W-r :
    print('Yes')
else :
  print('No')


Fixed submission:
W,H,x,y,r = map(int,input().split())

if (r <= y and y <= H-r) :
  if (r <= x and x <= W-r ):
    print('Yes')
  else :
    print('No')
else :
  print('No')
Buggy python submission (verdict: Runtime Error):
i = 1
while True :
  x = int(input())
  if x = = 0 :
    break
  print('Case',i,':',x)
  i = i + 1
  


Fixed submission:
i = 1
while True :
  x = int(input())
  if x == 0 :
    break
  print('Case ',i,': ',x,sep='')
  i += 1

Buggy python submission (verdict: Runtime Error):
i = 1
while True :
  x = int(input())
  if x = = 0 :
    break
  print('Case',i':',x)
  i = i + 1
  


Fixed submission:
i = 1
while True :
  x = int(input())
  if x == 0 :
    break
  print('Case ',i,': ',x,sep='')
  i += 1

Buggy python submission (verdict: Runtime Error):
i = 1
while True :
  x = int(input())
  if x = = 0 :
    break
  print('Case',I,':',x)
  i = i + 1
  


Fixed submission:
i = 1
while True :
  x = int(input())
  if x == 0 :
    break
  print('Case ',i,': ',x,sep='')
  i += 1
Buggy python submission (verdict: Runtime Error):

a,b,c
x = input()
n = list(map(int,input().split()))
​
a = min(n)
b = max(n)
c = sum(n)
​
print(a,b,c)


Fixed submission:
n = int(input())
k = list(map(int,input().split()))

a = min(k)
b = max(k)
c = sum(k)

print(a,b,c)

Buggy python submission (verdict: Runtime Error):

x = input()
n = list(map(int,input().split()))
​
a = min(n)
b = max(n)
c = sum(n)
​
print(a,b,c)


Fixed submission:
n = int(input())
k = list(map(int,input().split()))

a = min(k)
b = max(k)
c = sum(k)

print(a,b,c)

Buggy python submission (verdict: Runtime Error):

x = int(input())
n = list(map(int,input().split()))
​
a = min(n)
b = max(n)
c = sum(n)
​
print(a,b,c)


Fixed submission:
n = int(input())
k = list(map(int,input().split()))

a = min(k)
b = max(k)
c = sum(k)

print(a,b,c)
Buggy python submission (verdict: Runtime Error):
while True :
  H,W = map(int,input().split())
  if W == 0 and H == 0 :
    break
  for i in range(H) : 
      if i == 0 or i == H-1 :       
        print('#'*W)
      else  :
        print('#' + '.'*(W-2) + '#')
   print('')


Fixed submission:
while True :
  H,W = map(int,input().split())
  if W == 0 and H == 0 :
    break
  for i in range(H) : 
      if i == 0 or i == H-1 :       
        print('#'*W)
      else  :
        print('#' + '.'*(W-2) + '#')
  print('')
Buggy python submission (verdict: Runtime Error):
#a, b, c = map(int, input(). split())
na = list(map(int, input(). split()))
#print(dir(ns))
ns. sort()
#print(ns[0], ns[1], ns[2])
print(ns)
print(*ns)



Fixed submission:
a = list(map(int, input().split()))
a.sort()
print(a[0], a[1], a[2])
Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input(). split())
if 2*r >= W or 2*r >= H or x >= W or y >= H:
       print(‘No’)
else
       print(‘Yes’)


Fixed submission:
W, H, x, y, r = map(int, input().split())
if x < r or y < r or W - x < r or H - y < r:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
#入力
n = int(input())
a = list(map(int,input().split()))

a.reverse()

print(*a)


Fixed submission:
a = list(map(int, input().split()))
a.sort()
print(a[0], a[1], a[2])

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
x = a,b,c
x.sort()
print(x)


Fixed submission:
num = list(map(int,input().split()))
num.sort()
print(num[0],num[1],num[2])
Buggy python submission (verdict: Runtime Error):
W,H,x,y,r = map(int,input().split())
if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H:
  print('Yes')
else:
  print('No)


Fixed submission:
W,H,x,y,r = map(int,input().split())
if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
i = 1
while True:
  x = int(input())
  if x == 0 :
    break
  print("Case","", i,":","",x)
  i += 


Fixed submission:
i = 1
while True:
  x = int(input())
  if x == 0 :
    break
  print("Case {}: {}".format(i,x))
  i += 1
Buggy python submission (verdict: Runtime Error):
import sys
from enum import Enum, auto

class Triangle(Enum):
    NOTRIANGLE = 0
    ACUTE = 1
    RIGHT = 2
    OBTUSE = 3

def triangle_check(a, b, c):
    e1, e2, e3 = sorted([a, b, c], reverse=True)
    if e1 <= 0 or e2 <= 0 or e3 <= 0: return Triangle.NOTRIANGLE
    if e1 < e2 + e3: return Triangle.NOTRIANGLE
    if e1**2 == e2**2 + e3**2: return Triangle.RIGHT
    elif e1**2 < e2**2 + e3**2: return Triangle.ACUTE
    elif e1**2 > e2**2 + e3**2: return Triangle.OBTUSE

ans = [0 for i in range(4)]

lines = sys.stdin.readlines()
for line in lines:
    a, b, c = list(map(int, line.split(' ')))
    rst = triangle_check(a, b, c)
    if rst == 0:
        print(' '.join(list(map(str, ans))))
        break
    ans[0] += 1
    ans[rst] += 1


Fixed submission:
import sys

def triangle_check(a, b, c):
    e1, e2, e3 = sorted([a, b, c], reverse=True)
    if e1 <= 0 or e2 <= 0 or e3 <= 0: return 0
    if e1 > e2 + e3: return 0
    if e1**2 == e2**2 + e3**2: return 1
    elif e1**2 < e2**2 + e3**2: return 2
    elif e1**2 > e2**2 + e3**2: return 3

ans = [0 for i in range(4)]

lines = sys.stdin.readlines()
for line in lines:
    a, b, c = list(map(int, line.split(' ')))
    rst = triangle_check(a, b, c)
    if rst == 0:
        print(' '.join(list(map(str, ans))))
        break
    ans[0] += 1
    ans[rst] += 1

Buggy python submission (verdict: Runtime Error):
import sys
from enum import Enum, auto

class Triangle(Enum):
    NOTRIANGLE = 0
    ACUTE = 1
    RIGHT = 2
    OBTUSE = 3

def triangle_check(a, b, c):
    e1, e2, e3 = sorted([a, b, c], reverse=True)
    if e1 <= 0 or e2 <= 0 or e3 <= 0: return Triangle.NOTRIANGLE
    if e1 < e2 + e3: return Triangle.NOTRIANGLE
    if e1**2 == e2**2 + e3**2: return Triangle.RIGHT
    elif e1**2 < e2**2 + e3**2: return Triangle.ACUTE
    elif e1**2 > e2**2 + e3**2: return Triangle.OBTUSE

ans = [0 for i in range(4)]

lines = sys.stdin.readlines()
for line in lines:
    a, b, c = list(map(int, line.split(' ')))
    rst = triangle_check(a, b, c)
    if rst == 0:
        print(' '.join(list(map(str, ans))))
        break
    ans[0] += 1
    ans[int(rst)] += 1


Fixed submission:
import sys

def triangle_check(a, b, c):
    e1, e2, e3 = sorted([a, b, c], reverse=True)
    if e1 <= 0 or e2 <= 0 or e3 <= 0: return 0
    if e1 > e2 + e3: return 0
    if e1**2 == e2**2 + e3**2: return 1
    elif e1**2 < e2**2 + e3**2: return 2
    elif e1**2 > e2**2 + e3**2: return 3

ans = [0 for i in range(4)]

lines = sys.stdin.readlines()
for line in lines:
    a, b, c = list(map(int, line.split(' ')))
    rst = triangle_check(a, b, c)
    if rst == 0:
        print(' '.join(list(map(str, ans))))
        break
    ans[0] += 1
    ans[rst] += 1
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

import numpy as np

N, M = list(map(int, input().split(' ')))
A = [int(input()) for _ in range(N)]
B = [int(input()) for _ in range(M)]
scores = [0 for _ in range(N)]

for j in range(M):
    for i in range(N):
        if A[i] <= B[j]:
            scores[i] += 1
            break

print(np.argmax(scores) + 1)


Fixed submission:
# coding: utf-8

N, M = list(map(int, input().split(' ')))
A = [int(input()) for _ in range(N)]
B = [int(input()) for _ in range(M)]
scores = [0 for _ in range(N)]

for j in range(M):
    for i in range(N):
        if A[i] <= B[j]:
            scores[i] += 1
            break

max_i, max_val = 0, 0
for i in range(N):
    if scores[i] > max_val:
        max_val = scores[i]
        max_i = i
print(max_i + 1)
Buggy python submission (verdict: Runtime Error):
class Color(Enum):
    WHITE = auto() # 未訪問の頂点
    GRAY = auto() # 訪問済みだが, 全ての接点の調査は済んでいない状態の接点
    BLACK = auto() # 訪問, 調査済みの接点

n = int(input())
d = [0 for i in range(n)]
f = [0 for i in range(n)]

colors = [] # 頂点の訪問状態
A = [[0 for j in range(n)] for i in range(n)] # 隣接行列
# stack = [] ## スタックによる実装では頂点の保持が必要 => 再帰によって実装

# 隣接行列の初期化
for i in range(n):
    arr = list(map(int, input().split(' ')))
    u, k, v = arr[0], arr[1], arr[2:]
    for j in range(k):
        A[u-1][v[j]-1] = 1

time = 0
def dfs_init():
    global colors
    colors = [Color.WHITE for i in range(n)]
    dfs(0)

def dfs(u):
    global time
    colors[u] = Color.GRAY
    time += 1
    d[u] = time
    for v in range(n):
        if A[u][v] == 1 and colors[v] == Color.WHITE:
            dfs(v)
    colors[u] = Color.BLACK
    time += 1
    f[u] = time

dfs_init()
for u in range(n):
    if colors[u] == Color.WHITE:
        dfs(u)

# 出力
for i in range(n):
    print(i+1, d[i], f[i])


Fixed submission:
from enum import Enum, auto

class Color(Enum):
    WHITE = auto() # 未訪問の頂点
    GRAY = auto() # 訪問済みだが, 全ての接点の調査は済んでいない状態の接点
    BLACK = auto() # 訪問, 調査済みの接点

n = int(input())
d = [0 for i in range(n)]
f = [0 for i in range(n)]

colors = [] # 頂点の訪問状態
A = [[0 for j in range(n)] for i in range(n)] # 隣接行列
# stack = [] ## スタックによる実装では頂点の保持が必要 => 再帰によって実装

# 隣接行列の初期化
for i in range(n):
    arr = list(map(int, input().split(' ')))
    u, k, v = arr[0], arr[1], arr[2:]
    for j in range(k):
        A[u-1][v[j]-1] = 1

time = 0
def dfs_init():
    global colors
    colors = [Color.WHITE for i in range(n)]
    dfs(0)

def dfs(u):
    global time
    colors[u] = Color.GRAY
    time += 1
    d[u] = time
    for v in range(n):
        if A[u][v] == 1 and colors[v] == Color.WHITE:
            dfs(v)
    colors[u] = Color.BLACK
    time += 1
    f[u] = time

dfs_init()
for u in range(n):
    if colors[u] == Color.WHITE:
        dfs(u)

# 出力
for i in range(n):
    print(i+1, d[i], f[i])
Buggy python submission (verdict: Runtime Error):
from heapq import heappush, heappop
from enum import Enum, auto

INFTY = float('inf')

class Color(Enum):
    WHITE = auto()
    GRAY = auto()
    BLACK = auto()

n = int(input())
M = [[-1 for i in range(n)] for i in range(n)]
adj_list = []
for i in range(n):
    u, k, *kv = list(map(int, input().split(' ')))
    if k == 0: continue
    adj_list.append(kv)
    for j in range(0,2*k,2):
        M[i][kv[j]] = kv[j+1]
colors = []
d = []

def dijkstra(s):
    global d
    colors = [Color.WHITE for i in range(n)]
    d = [INFTY for i in range(n)]
    pque = []
    d[0] = 0

    heappush(pque, (0, s))

    while len(pque) >= 1:
        vert_u = heappop(pque)
        u = vert_u[1]
        colors[u] = Color.BLACK
        if d[u] < vert_u[0]: continue
        i = 0
        while i <= len(adj_list[u])-2:
            v = adj_list[u][i]
            if colors[v] != Color.BLACK:
                if d[u] + adj_list[u][i+1] < d[v]:
                    d[v] = d[u] + adj_list[u][i+1]
                    colors[v] = Color.GRAY
                    heappush(pque, (d[v], v))
            i += 2

dijkstra(0)
for i in range(n):
    print(i, d[i])



Fixed submission:
from heapq import heappush, heappop
from enum import Enum, auto

INFTY = float('inf')

class Color(Enum):
    WHITE = auto()
    GRAY = auto()
    BLACK = auto()

n = int(input())
adj_list = []
for i in range(n):
    u, k, *kv = list(map(int, input().split(' ')))
    adj_list.append(kv)

colors = []
d = []

def dijkstra(s):
    global d
    colors = [Color.WHITE for i in range(n)]
    d = [INFTY for i in range(n)]
    pque = []
    d[s] = 0

    heappush(pque, (0, s))

    while len(pque) >= 1:
        vert_u = heappop(pque)
        u = vert_u[1]
        colors[u] = Color.BLACK
        if d[u] < vert_u[0]: continue
        i = 0
        while i <= len(adj_list[u])-2:
            v = adj_list[u][i]
            if colors[v] != Color.BLACK:
                if d[u] + adj_list[u][i+1] < d[v]:
                    d[v] = d[u] + adj_list[u][i+1]
                    colors[v] = Color.GRAY
                    heappush(pque, (d[v], v))
            i += 2

dijkstra(0)
for i in range(n):
    print(i, d[i])
Buggy python submission (verdict: Runtime Error):
#! python3
# prime_number.py

import math

def is_prime_number(x):
    if x < 2: return False
    elif x == 2: return True
    elif x%2 == 0: return False

    sqrt_upper_bound = math.ceil(math.sqrt(x))
    for i in range(3, sqrt_upper_bound, 2):
        if num % i == 0:
            return False

    return True

n = int(input())
prime_num = 0
for i in range(n):
    x = int(input())
    if is_prime_number(x):
        prime_num += 1

print(prime_num)



Fixed submission:
#! python3
# prime_number.py

import math

def is_prime_number(x):
    if x < 2: return False
    elif x == 2: return True
    elif x%2 == 0: return False

    sqrt_upper_bound = math.floor(math.sqrt(x))+1
    for i in range(3, sqrt_upper_bound, 2):
        if x % i == 0:
            return False

    return True

n = int(input())
prime_num = 0
for i in range(n):
    x = int(input())
    if is_prime_number(x):
        prime_num += 1

print(prime_num)