Problem p02833 (python)

Fixed submission:
def findTrailingZeros(n): 
      
    if (n%2!=0): 
        return 0

    else: 
        ans = 0
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        return ans 
  
n = int(input())
  
print(findTrailingZeros(n))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
 
def main():
    a,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,a)+comb(a,b))%MOD)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 a= int(readline())
if a % 2 == 1:
    print(0)
else:
    a //= 2
    ans = 0
    while a:
        a //= 5
        ans += a
    print(ans)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h> 
using namespace std; 
  
// Function to return the count of 
// trailing 0s in the given function 
int findTrailingZeros(int n) 
{ 
    // If n is odd 
    if (n & 1) 
        return 0; 
  
    // If n is even 
    else { 
        int ans = 0; 
  
        // Find the trailing zeros 
        // in n/2 factorial 
        n /= 2; 
        while (n) { 
            ans += n / 5; 
            n /= 5; 
        } 
  
        // Return the required answer 
        return ans; 
    } 
} 
  
// Driver code 
int main() 
{ 
    int n;
    cin>>n; 
  
    cout << findTrailingZeros(n); 
  
    return 0; 
}

Buggy submission (verdict: Runtime Error):
import sys
import numpy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p = int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while p:
        p //= 5
        ans += p
    print(ans

Buggy submission (verdict: Runtime Error):
def fac(n):
    if(n==0 or n==1):
        return 1
    else:
        return (n * fac(n-2))

n = int(input())
string = ""
x = 0
if(n == 0):
    print("1")
elif(n==1):
    print("0")
else:
    x = fac(n)

    string = str(x)
    # print(string)
    count=0
    
    for i in range((len(string)-1),0,-1):
        # print(string[i])
        if(string[i]=="0"):
            count+=1
        else:
            break
    print("Count : ",count)

Buggy submission (verdict: Runtime Error):
n=int(input('enter number'))
def doublefactorial(n): 
    if (n == 0 or n == 1): 
        return 1; 
    return n * doublefactorial(n - 2);

def trailing_zeros(longint):
    manipulandum = str(longint)
    return len(manipulandum)-len(manipulandum.rstrip('0'))
  

print(trailing_zeros(doublefactorial(n)))

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p= int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while n:
        p //= 5
        ans += p
    print(ans)

Buggy submission (verdict: Runtime Error):
u = int(input())
two = 0
five = 0
while u > 1:
  if u % 2 == 0:
    two = two  + 1
  if u % 5 == 0:
    five = five + 1
  u = u - 2
print(min(two ,five)