Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03127 (python)

Fixed submission:
from fractions import gcd

n = int(input())
k = list(map(int, input().split()))
ans = k[0]

for i in k:
    ans = gcd(ans, i)

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

n = int(input())
k = list(map(int, input().split()))
ans = k[0]

for i in k:
    ans = gcd(ans, i)

print(ans)
Problem p03221 (python)

Fixed submission:
from operator import itemgetter

n, m= map(int, (input().split()))
pyi = [list(map(int, (input().split()))) + [i] for i in range(m)]
pyi.sort(key=itemgetter(1))
pyi.sort(key=itemgetter(0))
cityflag = 0
ans = []
for rep in range(m):
    if pyi[rep][0] != pyi[rep - 1][0]:
        cityflag = 0

    cityflag += 1
    ans += [[pyi[rep][0] , cityflag, pyi[rep][2]]]

for i in sorted(ans, key=itemgetter(2)):
    print(str(i[0]).zfill(6) + str(i[1]).zfill(6))

Buggy submission (verdict: Runtime Error):
n, m= map(int, (input().split()))
pyi = [list(map(int, (input().split()))) + [i] for i in range(m)]
pyi.sort(key=itemgetter(1))
pyi.sort(key=itemgetter(0))
cityflag = 0
ans = []
for rep in range(m):
    if pyi[rep][0] != pyi[rep - 1][0]:
        cityflag = 0

    cityflag += 1
    ans += [[pyi[rep][0] , cityflag, pyi[rep][2]]]

for i in sorted(ans, key=itemgetter(2)):
    print(str(i[0]).zfill(6) + str(i[1]).zfill(6))
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)

n = int(input())
graph = [list() for i in range(n+1)]

for i in range(n-1):
   a, b, c = map(int, (input().split()))
   graph[a].append([b, c])
   graph[b].append([a, c])

q, k = map(int, input().split())

def dfs(pre, now, c):
    len_list[now] = min(len_list[now], len_list[pre] + c)

    while graph[now]:
        n, c = graph[now].pop()
        dfs(now, n, c)

len_list = [float("inf")] * (n + 1)
len_list[k] = 0
dfs(k, k, 0)

for _ in range(q):
    x, y = map(int, input().split())
    print(len_list[x] + len_list[y])

Buggy submission (verdict: Runtime Error):
n = int(input())
graph = [list() for i in range(n+1)]

for i in range(n-1):
   a, b, c = map(int, (input().split()))
   graph[a].append([b, c])
   graph[b].append([a, c])

len_list = [float("inf")] * (n + 1)
q, k = map(int, input().split())

def dfs(pre, now, c):
    len_list[now] = min(len_list[now], len_list[pre] + c)

    while graph[now]:
        n, c = graph[now].pop()
        dfs(now, n, c)

len_list[k] = 0
dfs(k, k, 0)

for _ in range(q):
    x, y = map(int, input().split())
    print(len_list[x] + len_list[y])
Problem p03835 (python)

Fixed submission:
n, s = map(int, (input().split()))
ans = 0

for x in range(n + 1):
    for y in range(n + 1):
        if 0 <= s - x - y <= n:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, s = map(int, (input().split()))
ans = 0

for x,y in product(range(n+1), range(n+1)):
    if 0 <= s - x - y <= n:
        ans += 1
print(ans)
Problem p02984 (python)

Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    X = []
    x1 = sum(A) - sum(A[1::2]) * 2
    X.append(x1)
    for i in range(1, N):
        X.append(2 * A[i-1] - X[i-1])
    s = ' '.join([str(x) for x in X])
    print(s)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import numpy as np

def solve(N: int, A: "List[int]"):
    K = np.eye(N)
    for i in range(N-1):
        K[i, i+1] = 1
    K[N-1, 0] = 1
    A = [2 * a for a in A]
    B = np.dot(np.linalg.inv(K), np.array(A))
    s = ' '.join([str(int(b)) for b in B])
    print(s)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
Problem p03135 (python)

Fixed submission:
T, X = [int(n) for n in input().split()]
print('{:.5f}'.format(T / X))

Buggy submission (verdict: Runtime Error):
 T, X = [int(n) for n in input().split()]

 print(T / X)
Problem p03137 (python)

Fixed submission:
N, M = [int(n) for n in input().split()]
X = sorted([int(n) for n in input().split()])

answer = 0

if N >= M:
    pass
else:
    diff = []
    for i in range(len(X) - 1):
        diff.append(X[i+1] - X[i])

    diff = list(reversed(sorted(diff)))
    s = 0
    for i in range(N - 1):
        s += diff[i]
    answer = X[-1] - X[0] - s

print(answer)

Buggy submission (verdict: Runtime Error):
 N, M = [int(n) for n in input().split()]
 X = sorted([int(n) for n in input().split()])

 if N >= M:
     print(0)
 else:
     diff = []
     for i in range(len(X) - 1):
         diff.append(X[i+1] - X[i])

     diff = list(reversed(sorted(diff)))
     s = 0

     for i in range(N - 1):
         s += diff[i]
     answer = X[-1] - X[0] - s
     print(answer)
Problem p03207 (python)

Fixed submission:
N = int(input())
P = []
for i in range(N):
  P.append(int(input()))
print(sum(P) - max(P) // 2)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = []
for i in range(N):
  P.append(int(input())
print(sum(P) - max(P) // 2)
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
a = []
for i in range(m):
    a.append(int(input()))

flag = 0
for i in range(m-1):
    if a[i+1] - a[i] == 0:
        flag = 1
        print(0)
        break

if flag == 0:
    b = [1]
    if len(a) != 0 and a[0] == 1:
        b.append(0)
        a.pop(0)
    else:
        b.append(1)
    for i in range(2, n+1):
        if len(a) != 0 and a[0] == i:
            b.append(0)
            a.pop(0)
        else:
            b.append((b[i-1]+b[i-2])%1000000007)

    print(b[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
for i in range(m):
    a.append(int(input()))

flag = 0
for i in range(m-1):
    if a[i+1] - a[i] == 0:
        flag = 1
        print(0)
        break

if flag == 0:
    b = [1]
    if a[0] == 1:
        b.append(0)
        a.pop(0)
    else:
        b.append(1)
    for i in range(2, n+1):
        if len(a) != 0 and a[0] == i:
            b.append(0)
            a.pop(0)
        else:
            b.append((b[i-1]+b[i-2])%1000000007)

    print(b[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
for i in range(m):
    a.append(int(input()))

flag = 0
for i in range(m-1):
    if a[i+1] - a[i] == 0:
        flag = 1
        print(0)
        break

if flag == 0:
    b = [1]
    if a[0] == 1:
        b.append(0)
        a.pop(0)
    else:
        b.append(1)
    for i in range(2, n+1):
        if len(a) != 0 and a[0] == i:
            b.append(0)
            a.pop(0)
        else:
            b.append((b[i-1]+b[i-2])%1000000007)

print(b[-1])
Problem p02682 (python)

Fixed submission:
a, b, c, k = map(int,input().split())
if k <= a :
	print(k)
elif k > a and k <= a+b :
	print(a)
else :
	print(2*a + b - k)

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int,input().split())
if k < a :
  print(k)
elif k> a and k=< a+b 
  print(a)
else :
  print(2*a + b - k)
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
2 ans = N // (A + B) * A
3 rem = N % (A + B)
4 ans += min(rem, A)
5 print(ans)
Problem p02759 (python)

Fixed submission:
n=int(input())
if n%2==0:
    print(n//2)
else:
    print(n//2+1)

Buggy submission (verdict: Runtime Error):
N,M=map(int, input().split())
SC=list(list(map(int, input().split())) for i in range(M))

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
sc=get_unique_list(SC)

if (N==3) & (max(sc)[0]!=3):
    sc.append([1,1])
if (N==2) & (max(sc)[0]!=2):
    sc.append([2,1])

res=0
if M==0:
    res=-1
for i in range(len(sc)):
    for j in range(len(sc)):
        if (i!=j) & (sc[i][0]==sc[j][0]):
            res=-1
            break
    break
for i in range(len(sc)):
    if (M!=1) & (sc[i][0]==1) & (sc[j][1]==0):
        res=-1
        break
if N<len(sc):
    res=-1
if res!=-1:
    for i in range(len(sc)):
        res = res + sc[i][1]*(10**(N-sc[i][0]))
print(res)
Problem p02689 (python)

Fixed submission:
import collections
N,M = map(int,input().split())
H=list(map(int,input().split()))
A=[None for _ in range(M)]
B=[None for _ in range(M)]
for i in range (M):
    A[i],B[i] = map(int,input().split())

C=[None for _ in range(N)]
for i in range(M):
    if H[A[i]-1]<H[B[i]-1]:
        C[A[i]-1]="bad"
    elif H[A[i]-1]>H[B[i]-1]:
        C[B[i]-1]="bad"
    elif H[A[i]-1]==H[B[i]-1]:
        C[A[i]-1]="bad"
        C[B[i]-1]="bad"
c = collections.Counter(C)
cook=c["bad"]
ans=N-cook
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
N,M = map(int,input().split())
H=list(map(int,input().split()))
A=[None for _ in range(M)]
B=[None for _ in range(M)]
for i in range (M):
    A[i],B[i] = map(int,input().split())

C=[None for _ in range(M)]
for i in range(M):
    if H[A[i]-1]<=H[B[i]-1]:
        C[A[i]-1]="bad"
    elif H[A[i]-1]>=H[B[i]-1]:
        C[B[i]-1]="bad"

c = collections.Counter(C)
cook=c["bad"]
ans=N-cook
print(ans)
Problem p02759 (python)

Fixed submission:
import math
N=int(input())
ans=math.ceil(N/2)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=ceil(N/2)
print(ans)
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
if a!=3 and b!=3:
    print("3")
elif a!=2 and b!=2:
    print("2")
elif a!=1 and b!=1:
    print("1")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
temp=0
count=0
for i in range(1,N+1):
    for j in range(temp,N):
        if (a[j]==i and count+1 == i):
            count=count+1
            temp=j
            break           
if count==0:
    print("-1")
else:
    print(N-count)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a=!3 and b=!3:
    print("3")
elif a=!2 and b=!2:
    print("2")
elif a=!1 and b=!1:
    print("1")
Problem p02879 (python)

Fixed submission:
a = input()
b = a.split()
c1 = int(b[0])
c2 = int(b[1])
if (1 <= c1 <= 9 and 1 <= c2 <= 9 ):
    ans = c1*c2
else:
    ans = -1

print(ans)

Buggy submission (verdict: Runtime Error):
import math 

def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right

def costsum(x,y):
    siguma =0
    Asort = quick_sort(x)
    Fsort = quick_sort(y)
    for i in range(N):
        siguma = siguma + Asort[i]*Fsort[N-i-1]
    return siguma
def maxseki(x,y):
    seki = 0
    count = 0
    Asort = quick_sort(x)
    Fsort = quick_sort(y)
    for i in range(N):
        if seki < Asort[i]*Fsort[N-i-1]:
            seki = Asort[i]*Fsort[N-i-1]
            count = i
    return count

input1 = input()
input2 = input()
input3 = input()

hairetu1 = input1.split()
hairetu2 = input2.split()
hairetu3 = input3.split()
N = int(hairetu1[0])
K = int(hairetu1[1])
A = [int(s) for s in hairetu2] 
F = [int(t) for t in hairetu3]

Asort = quick_sort(A)
Fsort = quick_sort(F)

for i in range(K):
    s=maxseki(Asort,Fsort)
    Asort[s]=Asort[s]-1


P = maxseki(Asort,Fsort)
maxcost = Asort[P]*Fsort[N-P-1]
if maxcost < 0:
    maxcost =0
print (maxcost)
Problem p03013 (python)

Fixed submission:
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
dp = [0]*(N+1)
dp[0]=1
a = [ni() for i in range(M)]
isbro = [1]*(N+1)
for i in range(M):
    isbro[a[i]]=0
#print(isbro)
for i in range(N):
    if(i-1>=0):
        dp[i+1] = dp[i]*isbro[i] + dp[i-1]*isbro[i-1]
    else:
        dp[i+1] = dp[i]*isbro[i]
    dp[i+1]%=MOD
#print(dp)
print(dp[N])

Buggy submission (verdict: Runtime Error):
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
if M>0:
    p=ni()
    a.append(p)
tmp=0
for i in range(M-1):
    tmp=ni()
    if(tmp-1==p):
        #a.append(tmp)
        print(0)
        exit()
    else:
        a.append(tmp)
dp = [0]*(N+1)
dp[0]=1
dp[1]=1
j=0
if(a[0]==0):
    j+=1
    dp[0]=0
if(a[0]==1):
    j+=1
    dp[1]=0
if(N==1):
    t= 1 if M>0 else 0
    print(t)
    exit()
if(N==2):
    for i in a:
        dp[i]=0
    print(dp[0]+dp[1])
    exit()


flag=True
for i in range(2,N+1):
    dp[i]=dp[i-1]+dp[i-2]
    dp[i]%=MOD
    if a[-1]<i or j>=len(a):
        flag=False
    if(flag and a[j]==i):
        dp[i]=0
        j+=1
    
#print(dp,a)
#print(dp)
print(dp[N])

Buggy submission (verdict: Runtime Error):
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
if M>0:
    p=ni()
    a.append(p)
tmp=0
for i in range(M-1):
    tmp=ni()
    if(tmp-1==p):
        #a.append(tmp)
        print(0)
        exit()
    else:
        a.append(tmp)
dp = [0]*(N+1)
dp[0]=1
dp[1]=1
j=0
if(a[0]==0):
    j+=1
    dp[0]=0
if(a[0]==1):
    j+=1
    dp[1]=0


flag=True
for i in range(2,N+1):
    dp[i]=dp[i-1]+dp[i-2]
    dp[i]%=MOD
    if(flag and a[j]==i):
        dp[i]=0
        j+=1
    if a[-1]<i or j==len(a):
        flag=False
#print(dp,a)
#print(dp)
print(dp[N])
Problem p03013 (python)

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

a = []
for i in range(m):
    a.append(int(input()))
a = set(a)

dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
a = []
for i in range(m):
    a.append(int(input()))
 
dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
a = []
for i in range(m):
    a.append(int(input()))
 
dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    print(now, dp[now])
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])
Problem p02847 (python)

Fixed submission:
s = input()
if s == "SUN":
  print(7)
elif s == "MON":
  print(6) 
elif s == "TUE":
  print(5)
elif s == "WED":
  print(4)
elif s == "THU":
  print(3)
elif s == "FRI":
  print(2)
else:
  print(1)

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

def cal(n):
    return a*n + b*len(str(n))

l = 0
r = 10**9+1

while r-l > 1:
    n = (l+r) // 2
    if cal(n) >= x:
        r = n
    else:
        l = n

print(n)
Problem p03250 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
lis = list(map(int, input().split()))
lis.sort()
print(lis[2]*10 + lis[1] + lis[0])
Problem p02831 (python)

Fixed submission:
A , B = map( int , input().split() )

import fractions

print( A * B // fractions.gcd( A , B ))

Buggy submission (verdict: Runtime Error):
import math

A , B = map( int , input().split() )

print( A * B // math.gcd( A , B ))

Buggy submission (verdict: Runtime Error):
A , B = map( int , input().split() )

import math

print( A * B // math.gcd( A , B ))
Problem p02753 (python)

Fixed submission:
S = input()
 
if (S == 'AAA') or (S=='BBB'):
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S = input()
 
if (S == 'AAA') or (S=='BBB'):
  print 'No'
else:
  print 'Yes'

Buggy submission (verdict: Runtime Error):
S = input()
 
if S == 'AAA' or 'BBB':
  print 'No'
else:
  print 'Yes'

Buggy submission (verdict: Runtime Error):
S = input().strip()

if S == 'AAA' or 'BBB':
  return 'No'
else:
  return 'Yes'
Problem p02754 (python)

Fixed submission:
N, A, B = map(int,input().split())
a = N//(A+B)
b = N%(A+B)
if b>A:
    print(A*a+A)
else:
    print(A*a+b)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int,input().split())
re = ''
while len(re)<N:
    re+='b'*A
    re+='r'*B

print(re[:N].count('b'))
Problem p02881 (python)

Fixed submission:
n = int(input())
import math
start = math.floor(math.sqrt(n))
for i in reversed(range(start+1)):
    if i == 0:
        i = n
    else:
        if n/i == int(n/i):
            break
print(i+n//i-2)

Buggy submission (verdict: Runtime Error):
n = int(input())
import math
start = math.floor(math.sqrt(n))
for i in reversed(range(start)):
    if n/i == int(n/i):
        break
print(i+n//i-2)
Problem p03805 (python)

Fixed submission:
n,m = map(int,input().split())
path = [input().split() for x in range(m)]

table = [[] for x in range(n)]
for x in path:
    table[int(x[0])-1].append(int(x[1])-1)
    table[int(x[1])-1].append(int(x[0])-1)
    
import itertools
count = 0
for z in itertools.permutations(range(0,n)):
    if z[0] == 0:
        for y in range(len(z)-1):
            if z[y+1] in table[z[y]]:
                continue
            else:
                count -= 1
                break
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input())
path = [map(int,input()) for x in range(m)]

table = [[] for x in range(n)]
for x in path:
    table[int(x[0])-1].append(int(x[1])-1)
    table[int(x[1])-1].append(int(x[0])-1)
    
import itertools
count = 0
for z in itertools.permutations(range(0,n)):
    if z[0] == 0:
        print(z)
        for y in range(len(z)-1):
            if z[y+1] in table[z[y]]:
                continue
            else:
                count -= 1
                break
        count += 1
Problem p02831 (python)

Fixed submission:
from fractions import gcd
def lcm(x, y):
    return (x // gcd(x, y) *y)
a,b = map(int,input().split())
ans = lcm(a, b)
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(x, y):
    return (x // math.gcd(x, y) *y)
a,b = map(int,input().split())
ans = lcm(a, b)
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(x, y):
    return (x // math.gcd(x, y) *y)
a,b = map(int,input().split())
ans = lcm(a, b)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return x // math.gcd(x, y) *y
a,b = map(int,input().split())
ans = lcm(a,b)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return x // math.gcd(x, y) *y
a,b = map(int,input().split())
ans = lcm(a,b)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return x // math.gcd(x, y) * y
a,b = map(int,input().split())
print(lcm(a,b))
Problem p02847 (python)

Fixed submission:
s = input()
if s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
s = input()
if s == "SUN":
    print(7)
elif s == "MON:
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED"
    print(4)
elif s == "THU"
    print(3)
elif s == "FRI"
    print(2)
else:
    print(1)
Problem p02833 (python)

Fixed submission:
import math as mt
N = int(input())

if N % 2 == 1 or N < 2:
    print(0)
    exit()

r = 0
L = int(mt.log(N,5))
for i in range(1,L+1):
    p = N//(5**i)//2
    r += p
    #print(N,5**i,p)
print(r)

Buggy submission (verdict: Runtime Error):
import math as mt
N = int(input())

if N % 2 == 1 and N == 0:
    print(0)
    exit()

r = 0
L = int(mt.log(N,5))
for i in range(1,L+1):
    p = N//(5**i)//2
    r += p
    #print(N,5**i,p)
print(r)

Buggy submission (verdict: Runtime Error):
import math as mt
N = int(input())

if N % 2 == 1:
    print(0)
    exit()

r = 0
L = int(mt.log(N,5))
for i in range(1,L+1):
    p = N//(5**i)//2
    r += p
    #print(N,5**i,p)
print(r)
Problem p03775 (python)

Fixed submission:
import math

N = int(input())

ans1 = 0

A = '1'
B = str(N)

if len(A)>=len(B):
    ans = len(A)
else:
    ans = len(B)
    
for i in range(2,int(math.sqrt(N))+1):
    A = i
    if N%A==0:
        B = int(N / A)
        A = str(A)
        B = str(B)
        if len(A)>=len(B):
            ans1 = len(A)
        else:
            ans1 = len(B)
        if ans1 <= ans:
            ans = ans1
    if len(str(A))==len(str(B)):
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

ans1 = 0

A = '1'
B = str(N)

if len(A)>=len(B):
    ans = len(A)
else:
    ans = len(B)
    
for i in range(2,int(math.sqrt(N)+1):
    A = i
    if N%A==0:
        B = int(N / A)
        A = str(A)
        B = str(B)
        if len(A)>=len(B):
            ans1 = len(A)
        else:
            ans1 = len(B)
        if ans1 <= ans:
            ans = ans1
    if len(str(A))==len(str(B)):
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())

ans1 = 0

A = '1'
B = str(N)

if len(A)>=len(B):
    ans = len(A)
else:
    ans = len(B)
    
for i in range(2,int(math.sqrt(N)+1):
    A = i
    if N%A==0:
        B = int(N / A)
        A = str(A)
        B = str(B)
        if len(A)>=len(B):
            ans1 = len(A)
        else:
            ans1 = len(B)
        if ans1 <= ans:
            ans = ans1
    if len(str(A))==len(str(B)):
        break
print(ans)