Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# 1-index
from sys import stdin
import numpy as np
N, C = [int(x) for x in stdin.readline().rstrip().split()]
imos = [[0]*(10**5+1) for i in range(C+1)]

for i in range(N):
    s, t, c = [int(x) for x in stdin.readline().rstrip().split()]
    imos[c][s] += 1
    if t <= 10**5:
        imos[c][t+1] -= 1

imos = np.array(imos)
# print(np.cumsum(imos,axis=1))
ans = max(np.cumsum(imos, axis=1).sum(axis=0))
print(ans)

Fixed submission:
# 1-index
from sys import stdin
import numpy as np
N, C = [int(x) for x in stdin.readline().rstrip().split()]
imos = np.array([[0]*(10**5+1) for i in range(C+1)])

for i in range(N):
    s, t, c = [int(x) for x in stdin.readline().rstrip().split()]
    imos[c, s - 1:t] = 1

imos = np.array(imos)
# print(np.cumsum(imos,axis=1))
ans = max(imos.sum(axis=0))
print(ans)

Buggy python submission (verdict: Runtime Error):
# 1-index
from sys import stdin
import numpy as np
N,C = [int(x) for x in stdin.readline().rstrip().split()]
imos = [[0]*(10**5+1) for i in range(C+1)]

for i in range(N):
    s,t,c = [int(x) for x in stdin.readline().rstrip().split()]
    imos[c][s] += 1
    imos[c][t+1] -= 1

imos = np.array(imos)
#print(np.cumsum(imos,axis=1))
ans = max(np.cumsum(imos,axis=1).sum(axis=0))
print(ans)

Fixed submission:
# 1-index
from sys import stdin
import numpy as np
N, C = [int(x) for x in stdin.readline().rstrip().split()]
imos = np.array([[0]*(10**5+1) for i in range(C+1)])

for i in range(N):
    s, t, c = [int(x) for x in stdin.readline().rstrip().split()]
    imos[c, s - 1:t] = 1

imos = np.array(imos)
# print(np.cumsum(imos,axis=1))
ans = max(imos.sum(axis=0))
print(ans)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
S = (stdin.readline().rstrip())
flag = False
for i in ["","A"]:
    for j in ["","A"]:
        for k in ["","A"]:
            for l in ["","A"]:
                s = i + KIH + j + B + k + R + l
                if S == s:
                    flag = True
if flag:
    print("YES")
else:
    print("NO")

Fixed submission:
from sys import stdin
S = (stdin.readline().rstrip())
flag = False
for i in ["","A"]:
    for j in ["","A"]:
        for k in ["","A"]:
            for l in ["","A"]:
                s = i + "KIH" + j + "B" + k + "R" + l
                if S == s:
                    flag = True
if flag:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
from sys import stdin
N = int(tdin.readline().rstrip())
Lucas_number = [0]*(N+1)
Lucas_number[0] = 2
Lucas_number[1] = 1
for i in range(2,N+1):
    Lucas_number[i] = Lucas_number[i-1] + Lucas_number[i-2]
print(Lucas_number[N])

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
Lucas_number = [0]*(N+1)
Lucas_number[0] = 2
Lucas_number[1] = 1
for i in range(2,N+1):
    Lucas_number[i] = Lucas_number[i-1] + Lucas_number[i-2]
print(Lucas_number[N])

Buggy python submission (verdict: Runtime Error):
from sys import stdin
N = (tdin.readline(),rstrip())
Lucas_number = [0]*(N+1)
Lucas_number[0] = 2
Lucas_number[1] = 1
for i in range(2,N+1):
    Lucas_number[i] = Lucas_number[i-1] + Lucas_number[i-2]
print(Lucas_number[N])

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
Lucas_number = [0]*(N+1)
Lucas_number[0] = 2
Lucas_number[1] = 1
for i in range(2,N+1):
    Lucas_number[i] = Lucas_number[i-1] + Lucas_number[i-2]
print(Lucas_number[N])
Buggy python submission (verdict: Runtime Error):
from sys import stdin
s1 = (stdin.readline().rstrip())
s2 = int(stdin.readline().rstrip())
if s1 == s2[::-1]:
    print("YES")
else:
    print("NO")

Fixed submission:
from sys import stdin
s1 = (stdin.readline().rstrip())
s2 = (stdin.readline().rstrip())
if s1 == s2[::-1]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N = int(stdin.readline().rstrip())
for h in range(1,3501):
    for n in range(1,3501):
        if (4*h*n-N*h-N*n) != 0:
            w = (N*h*n)/(4*h*n-N*h-N*n)
        else:
            continue
        if w.is_integer() and w > 0:
            print(h,n,int(w))
            break
    else:
        continue
    break

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
for h in range(1,3501):
    for n in range(1,3501):
        if (4*h*n-N*h-N*n) != 0:
            w = (N*h*n)/(4*h*n-N*h-N*n)
        else:
            continue
        if w.is_integer() and w > 0:
            print(h,n,int(w))
            break
    else:
        continue
    break
Buggy python submission (verdict: Runtime Error):
from sys import stdin
N = int(stdin.readline().rstrip())
for _ in range(N):
    data.append([int(x) for x in stdin.readline().rstrip().split()])

ans = 0
for i in data:
    ans += (i[1] - i[0] + 1)
print(ans)

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
data = []
for _ in range(N):
    data.append([int(x) for x in stdin.readline().rstrip().split()])

ans = 0
for i in data:
    ans += (i[1] - i[0] + 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from collections import defaultdict
N = int(stdin.readline().rstrip())
adj = defaultdict(set)

for i in range(N-1):
    a,b,c = [int(x) for x in stdin.readline().rstrip().split()]
    adj[a].add((b,c))
    adj[b].add((a,c))
    
Q,K = [int(x) for x in stdin.readline().rstrip().split()]

visited = [False]*(N+1)
dist = [0]*(N+1)

def dfs(i,j):
    if visited[i]:
        return
    dist[i] = j
    visited[i] = True
    
    for node,d in adj[i]:
        dfs(node,d+j)
        
dfs(K,0)

for i in range(Q):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    print(dist[x]+dist[y])

Fixed submission:
from sys import stdin
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
N = int(stdin.readline().rstrip())
adj = defaultdict(set)

for i in range(N-1):
    a,b,c = [int(x) for x in stdin.readline().rstrip().split()]
    adj[a].add((b,c))
    adj[b].add((a,c))
    
Q,K = [int(x) for x in stdin.readline().rstrip().split()]

visited = [False]*(N+1)
dist = [0]*(N+1)

def dfs(i,j):
    if visited[i]:
        return
    dist[i] = j
    visited[i] = True
    
    for node,d in adj[i]:
        dfs(node,d+j)
        
dfs(K,0)

for i in range(Q):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    print(dist[x]+dist[y])
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(M):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
shima = []

flag = False
for i in sorted(data):
    if i[0] == 1:
        shima.append(i[1])
    if (i[1] == N) and (i[0] in shima):
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(M):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
shima = set()

flag = False
for i in sorted(data):
    if i[0] == 1:
        shima.add(i[1])
    if (i[1] == N) and (i[0] in shima):
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(M):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
shima = []

flag = False
for i in sorted(data):
    if i[0] == 1:
        shima.append(i[1])
    if (i[1] == N) and (i[0] in shima):
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(M):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
shima = set()

flag = False
for i in sorted(data):
    if i[0] == 1:
        shima.add(i[1])
    if (i[1] == N) and (i[0] in shima):
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
a,b,c = [map(int,input().split())]
print(min(a+b,b+c,c+a))

Fixed submission:
a,b,c = list(map(int,input().split()))
print(min(a+b,b+c,c+a))
Buggy python submission (verdict: Runtime Error):
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
data = ["#"*(W+2)]
for _ in range(H):
    data.append("#" + input() + "#")
deta.append("#"*(W+2))
for j in data:
    print(j)

Fixed submission:
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
data = ["#"*(W+2)]
for _ in range(H):
    data.append("#" + input() + "#")
data.append("#"*(W+2))
for j in data:
    print(j)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

a = factorize(A)[0][1]
b = factorize(B)[0][1]
c = factorize(C)[0][1]

ans = max(a,b,c)
if ans == 1:
    ans = -1
print(ans)

Fixed submission:
from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0

if A == B == C:
    if A % 2 == 0:
        ans = -1
    else:
        ans = 0
elif A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
     ans = 0
else:
    for _ in range(1000):
        ta = A
        tb = B
        tc = C
        A = (tb/2) + (tc/2)
        B = (ta/2) + (tc/2)
        C = (ta/2) + (tb/2)
        ans += 1
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            break
        
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = list(map(int,input().split()))
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Fixed submission:
A,B,C = list(input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
students = []
for _ in range(N):
    students.append([int(x) for x in stdin.readline().rstrip().split()])

checkpoints = []
for _ in range(M):
    checkpoints.append([int(x) for x in stdin.readline().rstrip().split()])

for i in students:
    tmp = 10000 
    for ind,j in enumerate(checkpoints):
        dist = abs(i[0] - j[0]) + abs(i[1] - j[1])
        if dist < tmp:
            tmp = dist
            ans = ind+1
    print(ans)

Fixed submission:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
students = []
for _ in range(N):
    students.append([int(x) for x in stdin.readline().rstrip().split()])

checkpoints = []
for _ in range(M):
    checkpoints.append([int(x) for x in stdin.readline().rstrip().split()])

for i in students:
    tmp = 10**9 
    for ind,j in enumerate(checkpoints):
        dist = abs(i[0] - j[0]) + abs(i[1] - j[1])
        if dist < tmp:
            tmp = dist
            ans = ind+1
    print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int,input().split()))
if a == "D" and b == "D":
    print("H")
elif a == "D" and b == "H":
    print("D")
elif a == "H" and b == "H":
    print("H")
else:
    print("D")

Fixed submission:
a,b = list(map(str,input().split()))
if a == "D" and b == "D":
    print("H")
elif a == "D" and b == "H":
    print("D")
elif a == "H" and b == "H":
    print("H")
else:
    print("D")
Buggy python submission (verdict: Runtime Error):
x = int(input())
if X < 1200:
    print("ABC")
else:
    print("ARC")

Fixed submission:
x = int(input())
if x < 1200:
    print("ABC")
else:
    print("ARC")
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
K,S = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
for X in range(0,K+1):
    for Y in range(0,K+1):
        for Z in range(0,K+1):
            if X+Y+Z == S:
                ans += 1
print(ans)

Fixed submission:
from sys import stdin
K,S = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
for X in range(0,K+1):
    for Y in range(0,K+1):
            if 0 <= S-(X+Y) <= K:
                ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
import numpy as np
x,y = [int(x) for x in stdin.readline().rstrip().split()]
ans = [(y-x),(y-(-x))+1, (y-x)+2, (x-(-y))+1]
ans = np.array(ans)
ans = ans[ans > 0]
print(min(ans))

Fixed submission:
from sys import stdin
import numpy as np
x,y = [int(x) for x in stdin.readline().rstrip().split()]
ans = [(y-x),(y-(-x))+1, (-y+x)+2, (-x-y)+1]
ans = np.array(ans)
ans = ans[ans > 0]
print(min(ans))
Buggy python submission (verdict: Runtime Error):
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
C = []
for _ in range(N):
    C.append((input()))
for i in C:
    print(i)
    print(i)

Fixed submission:
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
C = []
for _ in range(H):
    C.append((input()))
for i in C:
    print(i)
    print(i)
Buggy python submission (verdict: Runtime Error):
import itertools
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(H):
    data.append(list(input()))

flag = False
for j in (itertools.product([0,1],repeat=int((H+W-2)/2))):
    route_flag = True
    right = 0
    down  = 0
    for k in j:
        if k == 1:
            right += 1
        else:
            down += 1
        if data[down][right] == ".":
            route_flag = False
    if route_flag:
        flag = True
    
if data[0][0] == ".":
    flag = False

if flag:
    print("Possible")
else:
    print("Impossible")

Fixed submission:
import itertools
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(H):
    data.append(list(input()))

right = 0
down  = 0
for i in data:
    for j in range(0,W-1):
        if i[j] == "#" and i[j+1] == "#":
            right += 1

data_t = []
for i in range(W):
    row = []
    for vector in data:
        row.append(vector[i])
    data_t.append(row)

for i in data_t:
    for j in range(0,H-1):
        if i[j] == "#" and i[j+1] == "#":
            down += 1

if down == H-1 and right == W-1:
    print("Possible")
else:
    print("Impossible")

Buggy python submission (verdict: Runtime Error):
import itertools
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(N):
    data.append(list(input()))

flag = False
for j in (itertools.product([0,1],repeat=(H+W-2))):
    route_flag = True
    right = 0
    down  = 0
    for k in j:
        if k == 1:
            right += 1
        else:
            down += 1
        if data[down][right] == ".":
            route_flag = False
    if foute_flag:
        flag = True
    
if data[0][0] == ".":
    flag = False

if flag:
    print("Possible")
else:
    print("Impossible")

Fixed submission:
import itertools
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(H):
    data.append(list(input()))

right = 0
down  = 0
for i in data:
    for j in range(0,W-1):
        if i[j] == "#" and i[j+1] == "#":
            right += 1

data_t = []
for i in range(W):
    row = []
    for vector in data:
        row.append(vector[i])
    data_t.append(row)

for i in data_t:
    for j in range(0,H-1):
        if i[j] == "#" and i[j+1] == "#":
            down += 1

if down == H-1 and right == W-1:
    print("Possible")
else:
    print("Impossible")
Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math
N = int(stdin.readline().rstrip())
t,a = [int(x) for x in stdin.readline().rstrip().split()]
 
for _ in range(N-1):
    T,A = [int(x) for x in stdin.readline().rstrip().split()]
    n = int(max(math.ceil(t/T),math.ceil(a/A)))
    t = n*T
    a = n*A
    
print(t+a)

Fixed submission:
print(len(set(input().split())))
Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math
N = int(stdin.readline().rstrip())
t,a = [int(x) for x in stdin.readline().rstrip().split()]
 
for _ in range(N-1):
    T,A = [int(x) for x in stdin.readline().rstrip().split()]
    int(n) = max(math.ceil(t/T),math.ceil(a/A))
    t = n*T
    a = n*A
    
print(t+a)

Fixed submission:
from sys import stdin
import math
N = int(stdin.readline().rstrip())
t,a = 1,1
 
for _ in range(N):
    T,A = [int(x) for x in stdin.readline().rstrip().split()]
    n = max((t + T - 1) // T,(a + A - 1) // A)
    t = n*T
    a = n*A
    
print(t+a)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
X = (stdin.readline().rstrip())
stack = []
for i in X:
    if i == "S":
        stack.append(i)
    elif i == "T" and stack[-1] == "S":
        stack.pop()
    else:
        stack.append(i)
print(len(stack))

Fixed submission:
from sys import stdin
from collections import deque
X = (stdin.readline().rstrip())
stack = []
for i in X:
    if i == "S":
        stack.append(i)
    elif (i == "T" and stack == []):
        stack.append(i)
    elif (i == "T" and stack[-1] == "S"):
        stack.pop()
    else:
        stack.append(i)
print(len(stack))

Buggy python submission (verdict: Runtime Error):
from sys import stdin
X = (stdin.readline().rstrip())
X_l = X[:(len(X)/2)]
X_r = X[(len(X)/2):]
print(len(X) - min(X_l.count("S"),X_r.count("T")) * 2)

Fixed submission:
from sys import stdin
from collections import deque
X = (stdin.readline().rstrip())
stack = []
for i in X:
    if i == "S":
        stack.append(i)
    elif (i == "T" and stack == []):
        stack.append(i)
    elif (i == "T" and stack[-1] == "S"):
        stack.pop()
    else:
        stack.append(i)
print(len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
X = (stdin.readline().rstrip())
for i in range(10**6):
    X = X.replace("ST","")
print(len(X))

Fixed submission:
from sys import stdin
from collections import deque
X = (stdin.readline().rstrip())
stack = []
for i in X:
    if i == "S":
        stack.append(i)
    elif (i == "T" and stack == []):
        stack.append(i)
    elif (i == "T" and stack[-1] == "S"):
        stack.pop()
    else:
        stack.append(i)
print(len(stack))
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from collections import deque
sa = deque(list((stdin.readline().rstrip())))
sb = deque(list((stdin.readline().rstrip())))
sc = deque(list((stdin.readline().rstrip())))

next = "a"
for i in range(300):
    if len(sa) == 0 and next == "a":
        print("A")
        break
    if len(sb) == 0 and next == "b":
        print("B")
        break
    if len(sc) == 0 and next == "c":
        print("C")
        break
    if next == "a":
        next = sa.popleft()
    if next == "b":
        next = sb.popleft()
    if next == "c":
        next = sc.popleft()

Fixed submission:
from sys import stdin
from collections import deque
sa = deque(list((stdin.readline().rstrip())))
sb = deque(list((stdin.readline().rstrip())))
sc = deque(list((stdin.readline().rstrip())))

next = "a"
for i in range(300):
    if len(sa) == 0 and next == "a":
        print("A")
        break
    if len(sb) == 0 and next == "b":
        print("B")
        break
    if len(sc) == 0 and next == "c":
        print("C")
        break
        
    
    if next == "a":
        next = sa.popleft()
    elif next == "b":
        next = sb.popleft()
    elif next == "c":
        next = sc.popleft()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
from collections import deque
sa = deque(list((stdin.readline().rstrip())))
sb = deque(list((stdin.readline().rstrip())))
sc = deque(list((stdin.readline().rstrip())))

next = "a"
for i in range(300):
    if next == "a":
        next = sa.popleft()
    if next == "b":
        next = sb.popleft()
    if next == "c":
        next = sc.popleft()
    if len(sa) == 0 and next == "a":
        print("A")
        break
    if len(sb) == 0 and next == "b":
        print("B")
        break
    if len(sc) == 0 and next == "c":
        print("C")
        break

Fixed submission:
from sys import stdin
from collections import deque
sa = deque(list((stdin.readline().rstrip())))
sb = deque(list((stdin.readline().rstrip())))
sc = deque(list((stdin.readline().rstrip())))

next = "a"
for i in range(300):
    if len(sa) == 0 and next == "a":
        print("A")
        break
    if len(sb) == 0 and next == "b":
        print("B")
        break
    if len(sc) == 0 and next == "c":
        print("C")
        break
        
    
    if next == "a":
        next = sa.popleft()
    elif next == "b":
        next = sb.popleft()
    elif next == "c":
        next = sc.popleft()
Buggy python submission (verdict: Runtime Error):
from sys import stdin
N = int(stdin.readline().rstrip())
A = []
for i in range(N):
    A.append(int(input()))
    
B = A[:]
    
ans1 = 0

for j in range(N):
    ans1 += (A[j]//2)
    A[j] = (A[j]%2)
    
for k in range(1,N):
    ans1 += min(A[k-1],A[k])
    A[k] = A[k] - min(A[k-1],A[k])
    
ans2 = 0
tmp = min(B[0],B[1])

for l in range(1,N):
    ans2 += min(B[l-1],B[l])
    B[l] = B[l] - min(B[l-1],B[l])
    B[l-1] = B[l-1] - min(B[l-1],B[l])

B[0] -= tmp

for m in range(N):
    ans2 += (B[m]//2)

print(max(ans1,ans2))

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
A = []
for i in range(N):
    A.append(int(input()))
    
ans = 0
for i in range(N-1):
    ans += (A[i]//2)
    A[i+1] -= min(A[i+1],A[i]%2)
    ans += min(A[i+1],A[i]%2)
ans += (A[-1]//2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
box = [1]*(N+1)
flag = False
n1_pass = {1}
for _ in range(M):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    if (x in n1_pass):
        n1_pass.add(y)
    box[x] -= 1
    box[y] += 1
    if box[x] == 0:
        n1_pass = n1_pass - {x}
    
print(len(n1_pass))

Fixed submission:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
box = [1]*(N+1)
red = [False]*(N+1)
red[1] = True
for _ in range(M):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    if red[x]:
        red[y] = True
    box[x] -= 1
    box[y] += 1
    if box[x] == 0:
        red[x] = False
ans = 0
for i in red:
    if i:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
box = [1]*(N+1)
flag = False
n1_pass = set()
n1_now = 0
for _ in range(M):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    box[x] -= 1
    box[y] += 1
    if box[x] == 0:
        n1_pass.remove(x)
    if x == 1 and not flag:
        n1_pass.add(y)
        n1_now = y
        flag = True
    if flag and x == n1_now:
        n1_pass.add(y)
        n1_now = y
ans = 0
for i in n1_pass:
    if box[i] > 0:
        ans += 1
print(ans)

Fixed submission:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
box = [1]*(N+1)
red = [False]*(N+1)
red[1] = True
for _ in range(M):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    if red[x]:
        red[y] = True
    box[x] -= 1
    box[y] += 1
    if box[x] == 0:
        red[x] = False
ans = 0
for i in red:
    if i:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = list(map(int(),input().split()))
d = sorted([A,B,C])
if d[0] == 5 and d[1] == 5 and d[2] == 7:
    print("YES")
else:
    print("NO")

Fixed submission:
A,B,C = list(map(int,input().split()))
d = sorted([A,B,C])
if d[0] == 5 and d[1] == 5 and d[2] == 7:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
from sys import stdin
N,L = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(N):
    data.append(int(input()))
print("".join(sorted(data)))

Fixed submission:
from sys import stdin
N,L = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(N):
    data.append((input()))
print("".join(sorted(data)))