Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import numpy as np

def main():
    S = input()
    
    lenS = len(S)
    N = 13
    DP = np.zeros(N, dtype=np.int64)
    DP[0] = 1
    
    mod = 10 ** 9 + 7
    mul = 1
    for i in reversed(range(lenS)):
        nextDP = np.zeros(N, dtype=np.int64)
        c = S[i]
        if c == '?':
            for k in range(10):
                for j in range(N):
                    nextDP[(k * mul + j) %N] += DP[j]
                    nextDP[(k * mul + j) %N] %= mod

        else:
            k = int(S[i])
            for j in range(N):
                nextDP[(k * mul + j) %N] += DP[j]
                nextDP[(k * mul + j) %N] %= mod

        mul *= 10
        mul %= N
        DP = nextDP

    return DP[5]

if __name__ == '__main__':
    print(main())



Fixed submission:
#!/usr/bin/env python

def main():
    S = input()
    
    lenS = len(S)
    N = 13
    DP = [0] * N
    DP[0] = 1
    
    mod = 10 ** 9 + 7
    mul = 1
    for i in reversed(range(lenS)):
        nextDP = [0] *13
        c = S[i]
        if c == '?':
            for k in range(10):
                for j in range(N):
                    nextDP[(k * mul + j) %N] += DP[j]
                    nextDP[(k * mul + j) %N] %= mod

        else:
            k = int(S[i])
            for j in range(N):
                nextDP[(k * mul + j) %N] += DP[j]
                nextDP[(k * mul + j) %N] %= mod

        mul *= 10
        mul %= N
        DP = nextDP

    return DP[5]

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main():
    r = int(input().strip())
    return(3 * r * r)

if __name__ == '__main__':
    print(main()


Fixed submission:
#!/usr/bin/env python

def main():
    r = int(input().strip())
    return(3 * r * r)

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import numpy as np

def main():
    N = int(input().strip())
    arr = np.zeros(N, np.int32)
    for i in range(N):
        arr[i] = int(input().strip())
    for i in range(N):
        if i == 0:
            tmp = arr[i]
            arr[i] = 0
            print(arr.max())

        else:
            arr[i-1] = tmp
            tmp = arr[i]
            arr[i] = 0
            print(arr.max())

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
import numpy as np

def main():
    N = int(input().strip())
    arr = np.zeros(N, np.int32)
    for i in range(N):
        arr[i] = int(input().strip())
    arr2 = np.sort(arr)[::-1]
    max1, max2 = arr2[0], arr2[1]

    for i in range(N):
        print(max1) if arr[i] != max1 else print(max2)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import numpy as np

def main():
    N = int(input().strip())
    arr = np.zeros(N, np.int32)
    for i in range(N):
        arr[i] = int(input().strip())
    for i in range(N):
        arr2 = np.copy(arr)
        arr2[i] = 0
        print(arr2.max())

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
import numpy as np

def main():
    N = int(input().strip())
    arr = np.zeros(N, np.int32)
    for i in range(N):
        arr[i] = int(input().strip())
    arr2 = np.sort(arr)[::-1]
    max1, max2 = arr2[0], arr2[1]

    for i in range(N):
        print(max1) if arr[i] != max1 else print(max2)

if __name__ == '__main__':
    main()

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

def main():
    N = int(input().strip())
    arr = np.zeros(N, np.int32)
    for i in range(N):
        arr[i] = int(input().strip())
    for i in range(N):
        arr2 = np.copy(arr)
        arr2[i] = 0
        print(arr2.max())


main()


Fixed submission:
#!/usr/bin/env python
import numpy as np

def main():
    N = int(input().strip())
    arr = np.zeros(N, np.int32)
    for i in range(N):
        arr[i] = int(input().strip())
    arr2 = np.sort(arr)[::-1]
    max1, max2 = arr2[0], arr2[1]

    for i in range(N):
        print(max1) if arr[i] != max1 else print(max2)

if __name__ == '__main__':
    main()

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

def main():
    N = int(input().strip())
    arr = np.zeros(N, np.int32)
    for i in range(N):
        arr[i] = int(input().strip())
    for i in range(N):
        arr2 = np.copy(arr)
        arr2[i] = 0
        print(arr2.max())

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
import numpy as np

def main():
    N = int(input().strip())
    arr = np.zeros(N, np.int32)
    for i in range(N):
        arr[i] = int(input().strip())
    arr2 = np.sort(arr)[::-1]
    max1, max2 = arr2[0], arr2[1]

    for i in range(N):
        print(max1) if arr[i] != max1 else print(max2)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main():
    N, A, B = list(map(int, input().strip().split()))
    if N * A < B:
        return N * A
    else:
        return B

 print(main())

Fixed submission:
#!/usr/bin/env python

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

if A * B < C:
    print(A * B)
else:
    print(C)
Buggy python submission (verdict: Runtime Error):
def main():

p = 2019
L, R = list(map(int, input().split()))
if (R - L) >= (p -1):
  ans = 0
  print(ans)
else:
  L, R = 
  if L < R:
    ans = L * (L+1)
  else:
    ans = 0
  print(ans)
  
main()


  


Fixed submission:
def main():
  p = 2019
  L, R = list(map(int, input().split()))
  
  if (R - L) >= p:
    ans = 0
    print(ans)
    
  else:
    L, R = L % p, R % p
    ans = 2019 ** 2
    for i in range(L, R + 1):
      for j in range(i+1, R+1):
        tmp = (i * j) % p
        if tmp < ans:
          ans = tmp
    print(ans)
    
main()

Buggy python submission (verdict: Runtime Error):
def main():

p = 2019
L, R = list(map(int, input().split()))
if (R - L) >= (p -1):
  ans = 0
  print(ans)
else:
  L, R = [x % p for x in [L, R]]
  if L < R:
    ans = L * (L+1)
  else:
    ans = 0
  print(ans)
  
main()


  

Fixed submission:
def main():
  p = 2019
  L, R = list(map(int, input().split()))
  
  if (R - L) >= p:
    ans = 0
    print(ans)
    
  else:
    L, R = L % p, R % p
    ans = 2019 ** 2
    for i in range(L, R + 1):
      for j in range(i+1, R+1):
        tmp = (i * j) % p
        if tmp < ans:
          ans = tmp
    print(ans)
    
main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import math

def count_antidivision(n, x, y):
    """
    returns count of numbers from 1 to n which are not dividable by x nor y.
    """
    return n - n // x - n // y + n // (x * y // math.gcd(x, y))    

def main(A, B, C, D):
    return count_antidivision(B, C, D) - count_antidivision(A-1, C, D)

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    print(main(A, B, C, D))




Fixed submission:
#!/usr/bin/env python
import fractions

def count_antidivision(n, x, y):
    """
    returns count of numbers from 1 to n which are not dividable by x nor y.
    """
    return n - n // x - n // y + n // (x * y // fractions.gcd(x, y))    

def main(A, B, C, D):
    return count_antidivision(B, C, D) - count_antidivision(A-1, C, D)

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    print(main(A, B, C, D))

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import math

def count_antidivision(n, x, y):
    """
    returns count of numbers from 1 to n which are not dividable by x nor y.
    """
    return n - n // x - n // y + n // (x * y // math.gcd(x, y))    

def main(A, B, C, D):
    return count_antidivision(B, C, D) - count_antidivision(A-1, C, D)

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    print(main(A, B, C, D))

Fixed submission:
#!/usr/bin/env python
import fractions

def count_antidivision(n, x, y):
    """
    returns count of numbers from 1 to n which are not dividable by x nor y.
    """
    return n - n // x - n // y + n // (x * y // fractions.gcd(x, y))    

def main(A, B, C, D):
    return count_antidivision(B, C, D) - count_antidivision(A-1, C, D)

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    print(main(A, B, C, D))

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import math

def count_antidivision(n, x, y):
    """
    returns count of numbers from 1 to n which are not dividable by x nor y.
    """
    return n - n // x - n // y + n // (x * y // math.gcd(x, y))    

def main(A, B, C, D):
    return count_antidivision(B, C, D) - count_antidivision(A-1, C, D)

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    print(main(A, B, C, D))

Fixed submission:
#!/usr/bin/env python
import fractions

def count_antidivision(n, x, y):
    """
    returns count of numbers from 1 to n which are not dividable by x nor y.
    """
    return n - n // x - n // y + n // (x * y // fractions.gcd(x, y))    

def main(A, B, C, D):
    return count_antidivision(B, C, D) - count_antidivision(A-1, C, D)

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    print(main(A, B, C, D))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main():
    N, M = map(int, input().split())
    S = [list(map(int, input().split() for _ in range(M)))]
    P = list(map(int, input().split()))
    ans = 0

    # all possible switch patterns
    for i in range(2 ** N):
        light_on = 0
        # all switch conditions
        for j in range(M):
            switch_on = 0
            # all connected switch
            for k in S[j][1:]:
                # convert integer to binary
                if (i >> k-1) & 1:
                    switch_on += 1
            if switch_on %2 == P[j]:
                light_on += 1
        if light_on == M:
            ans += 1

    return ans

if __name__ == '__main__':
    print(main())



Fixed submission:
#!/usr/bin/env python

def main():
    N, M = map(int, input().split())
    S = [list(map(int, input().split())) for _ in range(M)]
    P = list(map(int, input().split()))
    ans = 0

    # all possible switch patterns
    for i in range(2 ** N):
        light_on = 0
        # all switch conditions
        for j in range(M):
            switch_on = 0
            # all connected switch
            for k in S[j][1:]:
                # convert integer to binary
                if (i >> k-1) & 1:
                    switch_on += 1
            if switch_on %2 == P[j]:
                light_on += 1
        if light_on == M:
            ans += 1

    return ans

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main():
    N, M = map(int, input().split())
    INF = float('inf')

    LR = [-INF, INF]
    for _ in range(M):
        L, R = map(int, input().split())
        if LR[0] < L:
            LR[0] = L
        if LR[1] > R:
            LR[1] = R
    if LR[1] > LR[0]:
        return int(LR[1] - LR[0] + 1)
    else:
        return 0

if __name__ == '__main__':
    print(main())

Fixed submission:
#!/usr/bin/env python

def main():
    A, B = map(int, input().split())
    if A < 6:
        return 0
    elif A < 13:
        return B / 2
    else:
        return B

if __name__ == '__main__':
    print(int(main()))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
from math import log2, ceil

def main():
    N, K = map(int, input().split())

    ans = 0
    for i in range(1, N+1):
        n = ceil(log2(K) - log2(i))
        if n > 0:
            ans += 0.5 ** n
        else:
            ans += 1

    return ans / N

if __name__ == '__main__':
    print(main())

Fixed submission:
#!/usr/bin/env python
from math import log2, ceil

def main():
    N, K = map(int, input().split())

    ans = 0
    for i in range(1, N+1):
        n = ceil(log2(K) - log2(i))
        if n > 0:
            ans += 0.5 ** n
        else:
            ans += 1

    return ans / N

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Runtime Error):
#from math import gcd

def main():
    N = int(input())
    A = list(map(int, input().split()))

    L = [[] for i in range(N+1)]
    R = [[] for i in range(N+1)]
    L[0] = 0
    R[N] = 0

    for i in range(N):
        L[i+1] = gcd(L[i], A[i])
        R[N-1-i] = gcd(R[N-i], A[N-1-i])

    M = [[] for i in range(N)]
    for i in range(N):
        M[i] = gcd(L[i], R[i+1])

    return max(M)

if __name__ == '__main__':
    print(main())

Fixed submission:
#!/usr/bin/env python
from fractions import gcd
#from math import gcd

def main():
    N = int(input())
    A = list(map(int, input().split()))

    L = [[] for i in range(N+1)]
    R = [[] for i in range(N+1)]
    L[0] = 0
    R[N] = 0

    for i in range(N):
        L[i+1] = gcd(L[i], A[i])
        R[N-1-i] = gcd(R[N-i], A[N-1-i])

    M = [[] for i in range(N)]
    for i in range(N):
        M[i] = gcd(L[i], R[i+1])

    return max(M)

if __name__ == '__main__':
    print(main())

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
from math import gcd

def main():
    N = int(input())
    A = list(map(int, input().split()))

    L = [[] for i in range(N+1)]
    R = [[] for i in range(N+1)]
    L[0] = 0
    R[N] = 0

    for i in range(N):
        L[i+1] = gcd(L[i], A[i])
        R[N-1-i] = gcd(R[N-i], A[N-1-i])

    M = [[] for i in range(N)]
    for i in range(N):
        M[i] = gcd(L[i], R[i+1])

    return max(M)

if __name__ == '__main__':
    print(main())

Fixed submission:
#!/usr/bin/env python
from fractions import gcd
#from math import gcd

def main():
    N = int(input())
    A = list(map(int, input().split()))

    L = [[] for i in range(N+1)]
    R = [[] for i in range(N+1)]
    L[0] = 0
    R[N] = 0

    for i in range(N):
        L[i+1] = gcd(L[i], A[i])
        R[N-1-i] = gcd(R[N-i], A[N-1-i])

    M = [[] for i in range(N)]
    for i in range(N):
        M[i] = gcd(L[i], R[i+1])

    return max(M)

if __name__ == '__main__':
    print(main())

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
from math import gcd

def main():
    N = int(input())
    A = list(map(int, input().split()))

    L = [[] for i in range(N+1)]
    R = [[] for i in range(N+1)]
    L[0] = 0
    R[N] = 0

    for i in range(N):
        L[i+1] = gcd(L[i], A[i])
        R[N-1-i] = gcd(R[N-i], A[N-1-i])

    M = [[] for i in range(N)]
    for i in range(N):
        M[i] = gcd(L[i], R[i+1])

    return max(M)

if __name__ == '__main__':
    print(main())

Fixed submission:
#!/usr/bin/env python
from fractions import gcd
#from math import gcd

def main():
    N = int(input())
    A = list(map(int, input().split()))

    L = [[] for i in range(N+1)]
    R = [[] for i in range(N+1)]
    L[0] = 0
    R[N] = 0

    for i in range(N):
        L[i+1] = gcd(L[i], A[i])
        R[N-1-i] = gcd(R[N-i], A[N-1-i])

    M = [[] for i in range(N)]
    for i in range(N):
        M[i] = gcd(L[i], R[i+1])

    return max(M)

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import sys

def main():
    S = sys.stdin.readline().rstrip()
    N = len(S)
    s1 = ""
    s2 = ""
    for i in range(N):
        if i % 2 == 0:
            s1 = s1 + "1"
            s2 = s2 + "0"
        elif i % 2 == 1:
            s1 = s1 + "0"
            s2 = s2 + "1"

    ans = float("inf")
    tmp = 0
    for i, j in zip(S, s1):
        if i != j:
            tmp += 1
    ans = min(ans, tmp)
    tmp = 0
    for i, j in zip(S, s2):
        if i != j:
            tmp += 1
    ans = min(ans, tmp)
    print(ans)

if __name__ == '__main__':
    main()


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

def main():
    S = sys.stdin.readline().rstrip()
    N = len(S)

    ans = float("inf")
    tmp1 = 0
    tmp2 = 0
    for i in range(N):
        if i % 2 == 0:
            s1 = "1"
            s2 = "0"
            if S[i] != s1:
                tmp1 += 1
            elif S[i] != s2:
                tmp2 += 1
        elif i % 2 == 1:
            s1 = "0"
            s2 = "1"
            if S[i] != s1:
                tmp1 += 1
            elif S[i] != s2:
                tmp2 += 1
    print(min(tmp1, tmp2))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

def chmax(a, b):
    if a < b:
        return b
    else:
        return a

def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    dp = [inf] * 110000

    dp[0] = 0
    for i in range(n-1):
        for j in range(1, min(k+1, n-i)):
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i+j] - h[i]))
    print(dp[n-1])

if __name__ == '__main__':
    main()



Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

def chmax(a, b):
    if a < b:
        return b
    else:
        return a

def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    dp = [inf] * 110000

    dp[0] = 0
    for i in range(n-1):
        for j in range(1, min(k+1, n-i)):
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i+j] - h[i]))
    print(dp[n-1])

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
#from fractions import gcd
from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

def chmax(a, b):
    if a < b:
        return b
    else:
        return a

def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    dp = [inf] * 110000

    dp[0] = 0
    for i in range(n-1):
        for j in range(1, min(k+1, n-i)):
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i+j] - h[i]))
    print(dp[n-1])

if __name__ == '__main__':
    main()



Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

def chmax(a, b):
    if a < b:
        return b
    else:
        return a

def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    dp = [inf] * 110000

    dp[0] = 0
    for i in range(n-1):
        for j in range(1, min(k+1, n-i)):
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i+j] - h[i]))
    print(dp[n-1])

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    la = list(map(int, input().split()))
    lb = list(map(int, input().split()))
    lc = list(map(int, input().split()))
    
    la.sort()
    lb.sort()
    lc.sort()

    ans = 0
    for a in la:
        if a < lb[-1]:
            idxb = bisect.bisect_right(lb, a)
            for b in lb[idxb:]:
                if b < lc[-1]:
                    idxc = bisect.bisect_right(lc, b)
                    ans += (n - idxc)
    print(ans) 

if __name__ == '__main__':
    main()

Fixed submission:
s1 = input()
s2 = input()[::-1]
print("YES") if s1 == s2 else print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    la = list(map(int, input().split()))
    lb = list(map(int, input().split()))
    lc = list(map(int, input().split()))
    
    la.sort()
    lb.sort()
    lc.sort()

    ans = 0
    for a in la:
        if a < lb[-1]:
            idxb = bisect.bisect_right(lb, a)
            for b in lb[idxb:]:
                if b < lc[-1]:
                    idxc = bisect.bisect_right(lc, b)
                    ans += (n - idxc)
    print(ans) 

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    la = list(map(int, input().split()))
    lb = list(map(int, input().split()))
    lc = list(map(int, input().split()))
    
    la.sort()
    lb.sort()
    lc.sort()

    ans = 0
    for b in lb:
        idxa = bisect.bisect_left(la, b)
        idxc = bisect.bisect_right(lc, b)
        if idxa > 0 and idxc < n:
            ans += idxa * (n - idxc)
    print(ans) 

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if (a =< c) and (c =< b):
    print('Yes')
    
else:
    print('No')

Fixed submission:
a, b, c = map(int, input().split())
if (a <= c) and (c <= b):
    print('Yes')
    
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# problem B

a = int(input())
b = int(input())

def comp(a, b):
    if a < b:
        print("LESS")
    elif a < b:
        print("GREATER")
    else:
        print("EQUAL")

comp(a, b)

Fixed submission:
# -*- coding: utf-8 -*-
# problem A

s = input().split(' ')

print(s[0][0].upper() + s[1][0].upper() + s[2][0].upper())
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
from fractions import gcd
def main():
    N = int(input())
    ans = len(str(N))
    for i in range(1, N // 2 + 2):
        if N % i == 0:
            tmp = max(len(str(i)),  len(str(N // i)))
        if ans > tmp:
            ans = tmp
    print(ans)
    
if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
from fractions import gcd
def main():
    N = int(input())
    ans = len(str(N))
    for i in range(len(str(N)) // 2 + 1):
            for j in reversed(range(10**i, 10**(i+1))):
                if N % j == 0:
                    tmp = max(len(str(j)), len(str(N // j)))
                    if ans > tmp:
                        ans = tmp
                    break
    print(ans)

if __name__ == '__main__':
    main()