Buggy python submission (verdict: Runtime Error):
    import sys, re, os
    from collections import deque, defaultdict, Counter
    from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
    from itertools import permutations, combinations, product, accumulate
    from operator import itemgetter, mul
    from copy import deepcopy
    from string import ascii_lowercase, ascii_uppercase, digits
    from fractions import gcd
    def input(): return sys.stdin.readline().strip()
    def STR(): return input()
    def INT(): return int(input())
    def MAP(): return map(int, input().split())
    def S_MAP(): return map(str, input().split())
    def LIST(): return list(map(int, input().split()))
    def S_LIST(): return list(map(str, input().split()))
    sys.setrecursionlimit(10 ** 9)
    inf = sys.maxsize
    mod = 10 ** 9 + 7
     
    n, m = MAP()
    red = [False for _ in range(n)]
    bal = [1 for _ in range(n)]
    red[0] = 1
    for i in range(m):
        x, y = MAP()
        if red[x - 1]:
            red[y - 1] = True
            if bal[x - 1] == 1:
                red[x - 1] = False
        bal[x - 1] -= 1
        bal[y - 1] += 1
    print(sum(red))

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n, m = MAP()
red = [False for _ in range(n)]
bal = [1 for _ in range(n)]
red[0] = 1
for i in range(m):
    x, y = MAP()
    if red[x - 1]:
        red[y - 1] = True
        if bal[x - 1] == 1:
            red[x - 1] = False
    bal[x - 1] -= 1
    bal[y - 1] += 1
print(sum(red))

Buggy python submission (verdict: Runtime Error):
    import sys, re, os
    from collections import deque, defaultdict, Counter
    from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
    from itertools import permutations, combinations, product, accumulate
    from operator import itemgetter, mul
    from copy import deepcopy
    from string import ascii_lowercase, ascii_uppercase, digits
    from fractions import gcd
    def input(): return sys.stdin.readline().strip()
    def STR(): return input()
    def INT(): return int(input())
    def MAP(): return map(int, input().split())
    def S_MAP(): return map(str, input().split())
    def LIST(): return list(map(int, input().split()))
    def S_LIST(): return list(map(str, input().split()))
    sys.setrecursionlimit(10 ** 9)
    inf = sys.maxsize
    mod = 10 ** 9 + 7
     
    n, m = MAP()
    red = [False for _ in range(n)]
    bal = [1 for _ in range(n)]
    red[0] = 1
    for i in range(m):
        x, y = MAP()
        if red[x - 1]:
            red[y - 1] = True
            if bal[x - 1] == 1:
                red[x - 1] = False
        bal[x - 1] -= 1
        bal[y - 1] += 1
    print(sum(red))

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n, m = MAP()
red = [False for _ in range(n)]
bal = [1 for _ in range(n)]
red[0] = 1
for i in range(m):
    x, y = MAP()
    if red[x - 1]:
        red[y - 1] = True
        if bal[x - 1] == 1:
            red[x - 1] = False
    bal[x - 1] -= 1
    bal[y - 1] += 1
print(sum(red))