Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
c=[0 for i in range(N)]
c[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]-=t/(b[x[i]]+1)
    a[y[i]]+=t/(b[x[i]]+1)
    if b[x[i]]!=0:
        c[x[i]]=1
    else:
        c[x[i]]=0
    if t!=0:
        c[y[i]]=1
print(sum(c))


Fixed submission:
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]-=t/(b[x[i]]+1)
    a[y[i]]+=t/(b[x[i]]+1)
n=0
for i in range(N):
    if a[i]!=0:
        n+=1
print(n)


Fixed submission:
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
c=[0 for i in range(N)]
c[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]-=t/(b[x[i]]+1)
    a[y[i]]+=t/(b[x[i]]+1)
print(sum(c))


Fixed submission:
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
def plus(a,b):
    c=a[0]*b[1]+b[0]*a[1]
    d=a[1]*b[1]
    return (c,d)
def div(a,b):
    c=a[0]*b[1]
    d=a[1]*b[0]
    return (c,d)
def times(a,b):
    c=a[1]*b[1]
    d=a[0]*b[0]
    return (c,d)
def minus(a,b):
    c=a[0]*b[1]-b[0]*a[1]
    d=a[1]*b[1]
    return (c,d)

N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[(0,1) for i in range(N)]
a[0]=(1,1)
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]=minus(a[x[i]],div(t,(b[x[i]]+1,1)))
    a[y[i]]=plus(a[y[i]],div(t,(b[x[i]]+1,1)))
n=0
for i in range(N):
    if a[i][0]!=0:
        n+=1
print(n)


Fixed submission:
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
def plus(a,b):
    c=a[0]*b[1]+b[0]*a[1]
    d=a[1]*b[1]
    return (c,d)
def div(a,b):
    c=a[0]*b[1]
    d=a[1]*b[0]
    return (c,d)
def times(a,b):
    c=a[1]*b[1]
    d=a[0]*b[0]
    return (c,d)
def minus(a,b):
    c=a[0]*b[1]-b[0]*a[1]
    d=a[1]*b[1]
    return (c,d)

N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[(0,1) for i in range(N)]
a[0]=(1,1)
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]=minus(a[x[i]],div(t,(b[x[i]]+1,1)))
    a[y[i]]=plus(a[y[i]],div(t,(b[x[i]]+1,1)))
n=0
for i in range(N):
    if a[i][0]!=0:
        n+=1
print(n)


Fixed submission:
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(p,q):
    r=max([p,q])
    s=min([p,q])
    if s==0:
        return 1
    elif r%s==0:
        return s
    else:
        return gcd(s,r%s)
def plus(a,b):
    c=a[0]*b[1]+b[0]*a[1]
    d=a[1]*b[1]
    g=gcd(c,d)
    return (c//g,d//g)
def div(a,b):
    c=a[0]*b[1]
    d=a[1]*b[0]
    g=gcd(c,d)
    return (c//g,d//g)
def times(a,b):
    c=a[1]*b[1]
    d=a[0]*b[0]
    g=gcd(c,d)
    return (c//g,d//g)
def minus(a,b):
    c=a[0]*b[1]-b[0]*a[1]
    d=a[1]*b[1]
    g=gcd(c,d)
    return (c//g,d//g)

N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[(0,1) for i in range(N)]
a[0]=(1,1)
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]=minus(a[x[i]],div(t,(b[x[i]]+1,1)))
    a[y[i]]=plus(a[y[i]],div(t,(b[x[i]]+1,1)))
n=0
for i in range(N):
    if a[i][0]!=0:
        n+=1
print(n)


Fixed submission:
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(p,q):
    r=max([p,q])
    s=min([p,q])
    if s==0:
        return 1
    elif r%s==0:
        return s
    else:
        return gcd(s,r%s)
def plus(a,b):
    c=a[0]*b[1]+b[0]*a[1]
    d=a[1]*b[1]
    g=gcd(c,d)
    return (c//g,d//g)
def div(a,b):
    c=a[0]*b[1]
    d=a[1]*b[0]
    g=gcd(c,d)
    return (c//g,d//g)
def times(a,b):
    c=a[1]*b[1]
    d=a[0]*b[0]
    g=gcd(c,d)
    return (c//g,d//g)
def minus(a,b):
    c=a[0]*b[1]-b[0]*a[1]
    d=a[1]*b[1]
    g=gcd(c,d)
    return (c//g,d//g)

N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[(0,1) for i in range(N)]
a[0]=(1,1)
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]=minus(a[x[i]],div(t,(b[x[i]]+1,1)))
    a[y[i]]=plus(a[y[i]],div(t,(b[x[i]]+1,1)))
n=0
for i in range(N):
    if a[i][0]!=0:
        n+=1
print(n)


Fixed submission:
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))