Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N = int(input())

divList = []

n = N

while n != 1:
    if n % 2 == 0:
        n = n // 2
        divList.append(2)
        continue
    if n % 3 == 0:
        n = n // 3
        divList.append(3)
        continue

    newN = n
    isFind = False
    for i in range(6, int(n**(0.5) + 2), 6):
        if n % (i - 1) == 0:
            divList.append(i - 1)
            newN = newN // (i - 1)
            isFind = True
        if n % (i + 1) == 0:
            divList.append(i + 1)
            newN = newN // (i + 1)
            isFind = True

        if isFind == True:
            break

    if isFind == False:
        divList.append(n)
        newN = 1
    n = newN

    # print(divList)

# print(divList)

t = [([1], [1])]

for d in divList:
    newT = []
    for ab in t:
        a, b = ab[0], ab[1]
        a_add = a[:]
        a_add.append(d)
        b_add = b[:]
        b_add.append(d)

        newT.append((a, b_add))
        newT.append((a_add, b))
    t = newT

# print(t)

from functools import reduce

a1 = [(reduce(lambda a, b:a * b, ab[0]), reduce(lambda a, b:a * b, ab[1]))
      for ab in t]
# print(a1)


a2 = set([(len(str(ab[0])), len(str(ab[1]))) for ab in a1])

# print(a2)

a3 = [max(ab[0], ab[1]) for ab in a2]

# print(a3)

print(min(a3))


### FIXED CODE ###

N = int(input())


def countDigits(n):
    return len(str(n))


ans = countDigits(N)
A = 1
while A * A <= N:
    if(N % A != 0):
        A += 1
        continue
    B = N // A

    cur = max(countDigits(A), countDigits(B))
    if (ans > cur):
        ans = cur
    A += 1
print(ans)
### BUGGY CODE ###



import heapq
from collections import defaultdict
h = []
heapq.heapify(h)

n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]

ns = defaultdict(list)
uv2e = {}
for i in range(m):
    u,v,a[i],b[i] = list(map(int, input().split()))
    ns[u-1].append(v-1)
    ns[v-1].append(u-1)
    uv2e[u-1,v-1] = i
    uv2e[v-1,u-1] = i
for i in range(n):
    c[i], d[i] = list(map(int, input().split()))

maxs = max(a)*(n-1)
s = min(s, maxs)
state = (0, 0, s) # (距離, ノード, 銀貨枚数)
ans = [[None] * (maxs+1) for _ in range(n)]
heapq.heappush(h, state)
count = 0
while h:
    count += 1
    dd, u, ss = heapq.heappop(h)
#     print(dd, u, ss)
    ans[u][ss] = min(ans[u][ss], dd) if ans[u][ss] is not None else dd
    # グラフの隣接点
    for v in ns[u]:
        e= uv2e[u,v]
        if ss<a[e] or ans[v][ss-a[e]] is not None:
            continue
        heapq.heappush(h, (dd + b[e], v, ss-a[e]))
    # 両替
    if ss+c[u] <= maxs:
        heapq.heappush(h, (dd + d[u], u, ss+c[u]))
    elif ss < maxs:
        heapq.heappush(h, (dd + d[u], u, maxs))

for item in ans[1:]:
    print(min(item))

### FIXED CODE ###



import heapq
from collections import defaultdict
h = []
heapq.heapify(h)

n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]

ns = defaultdict(list)
uv2e = {}
for i in range(m):
    u,v,a[i],b[i] = list(map(int, input().split()))
    ns[u-1].append(v-1)
    ns[v-1].append(u-1)
    uv2e[u-1,v-1] = i
    uv2e[v-1,u-1] = i
for i in range(n):
    c[i], d[i] = list(map(int, input().split()))

maxs = max(a)*(n-1)
s = min(s, maxs)
state = (0, 0, s) # (距離, ノード, 銀貨枚数)
ans = [[None] * (maxs+1) for _ in range(n)]
heapq.heappush(h, state)
count = 0
while h:
    count += 1
    dd, u, ss = heapq.heappop(h)
#     print(dd, u, ss)
    if ans[u][ss] is not None and ans[u][ss] <= dd:
        continue
    ans[u][ss] = dd
    
    # グラフの隣接点
    for v in ns[u]:
        e= uv2e[u,v]
        if ss<a[e] or ans[v][ss-a[e]] is not None:
            continue
        heapq.heappush(h, (dd + b[e], v, ss-a[e]))
    # 両替
    if ss+c[u] <= maxs:
        heapq.heappush(h, (dd + d[u], u, ss+c[u]))
    elif ss < maxs:
        heapq.heappush(h, (dd + d[u], u, maxs))

for item in ans[1:]:
    print(min(item))
### BUGGY CODE ###

def cal():
    x = input()
    i = 0
    while i <= 10**5:
        i += 1
        x = x.replace('ST', '', 10**5)
    print(len(x))

cal()


### FIXED CODE ###

x = input()
ans = []

for i in x:
    if i == 'S':
        ans.append(i)
    else:
        if len(ans) == 0 or ans[-1] == 'T':
            ans.append(i)
        else:
            ans.pop()
print(len(ans))
### BUGGY CODE ###

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

  if N == 2:
    print(abs(h[1] - h[0]))
    exit()

  mi = min(N, K + 1)
  
  DP = [abs(h[i] - h[0]) for i in range(1, mi)]
  for i in range(1, N - 1):
    mi = min(N - i, K)
    t = DP[0]
    DP = [min(DP[j], abs(h[i + j] - h[i]) + t) for j in range(1, mi)]
    if i + K <= N - 1:
      DP.append(abs(h[i + K] - h[i]) + t)
  print(DP[0])
  
main()

### FIXED CODE ###

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

  if N == 2:
    print(abs(h[1] - h[0]))
    exit()

  DP = [0 for i in range(N)]

  mi = min(N, K + 1)
  for i in range(1, mi):
    DP[i] = abs(h[i] - h[0])
  for i in range(1, N - 1):
    mi = min(N, i + K)
    for j in range(i, mi):
      t = DP[i] + abs(h[j] - h[i])
      if DP[j] > t:
        DP[j] = t
    if i + K <= N - 1:
      DP[i+K] = DP[i] + abs(h[i+K] - h[i])
  print(DP[N-1])
  
main()
### BUGGY CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(n-k+1):
  if ans < sum(p[i:i+k]):
    ans = sum(p[i:i+k])
    ans_p = p[i:i+k]
ans_ = 0
for i in ans_p:
  ans_ += sum(range(i+1))/i
print(ans_)

### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
p_ = [(i+1)/2 for i in p]
d = [0]
for i in p_:
  d.append(d[-1]+i)
ans = 0
for i in range(k,n+1):
  if ans < d[i]-d[i-k]:
    ans = d[i]-d[i-k]
print(ans)
### BUGGY CODE ###

#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

import copy
N = int(input())
S = input()

hoge = ["R", "G", "B"]
ct = 0

def dfs(index, RGB, indexs):
    global ct
    if RGB[S[index]] == 1:
        return
    else:
        RGB[S[index]] = 1
        indexs += [index]
        
        if len(indexs) == 2:

            for key, value in RGB.items():
                if value == 0:
                    ct += Counter(S[index+1:])[key]
                    h = indexs[1]+indexs[1] - indexs[0] +1
                    if 0 < h <= N and S[h-1] == key:
                        ct -= 1

                    return

        for i in range(index+1, N):
            dfs(i, RGB.copy(), copy.copy(indexs))

for i in range(N):
    dfs(i, {"R":0, "G":0, "B":0}, [])

print(ct)

### FIXED CODE ###

#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

import copy
N = int(input())
S = input()

# ct = 0

# def dfs(index, RGB, indexs):
#     global ct
#     if RGB[S[index]] == 1:
#         return
#     else:
#         RGB[S[index]] = 1
#         indexs += [index]
        
#         if len(indexs) == 2:

#             for key, value in RGB.items():
#                 if value == 0:
#                     ct += Counter(S[index+1:])[key]
#                     h = indexs[1]+indexs[1] - indexs[0] +1
#                     if 0 < h <= N and S[h-1] == key:
#                         ct -= 1

#                     return

#         for i in range(index+1, N):
#             dfs(i, RGB.copy(), copy.copy(indexs))

# for i in range(N):
#     dfs(i, {"R":0, "G":0, "B":0}, [])

# print(ct)

c = Counter(S)
al = c["R"] * c["G"] * c["B"]

for i in range(N):
    for j in range(i+1, N):
        k = 2*j - i
        if k >= N: break
        if S[i] != S[k] and S[i] != S[j] and S[j] != S[k]:
            al -= 1
print(al)
### BUGGY CODE ###

n,k = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(n)]
ok = 10**29
ng = 0
while ok-ng > 1:
  mid = (ok+ng)//2
  tot = 0
  for w,d in l:
    if w > mid:
      continue
    tot += 1 + (mid-w)//d
  if tot >= k:
    ok = mid
  else:
    ng = mid
print(ok)

### FIXED CODE ###

n,k = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(n)]
ok = min(w+d*(k-1) for w,d in l)
ng = 0
while ok-ng > 1:
  mid = (ok+ng)//2
  tot = 0
  for w,d in l:
    if w > mid:
      continue
    tot += 1 + (mid-w)//d
  if tot >= k:
    ok = mid
  else:
    ng = mid
print(ok)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

def main():
    n=int(input().rstrip())
    a=sorted([int(i) for i in input().split()])
    maxn=10**6+1
    dp=[True]*(maxn)
    cnt=[0]*(maxn)
    ans=0
    for i in a:
        if dp[i]:
            cnt[i]+=1
            for j in range(i*2,maxn,i):
                dp[j]=False

    for i in a:
        if dp[i] and cnt[i]==1:
            #print(i)
            ans+=1
    print(ans)

if __name__=="__main__":main()

### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

N=int(input().rstrip())
a=[int(i) for i in input().split()]
l=max(a)+1
cnt=[0]*l
for i in a:
    for j in range(i,l,i):cnt[j]+=1

ans=0
for i in a:
    if cnt[i]==1:
        ans+=1
print(ans)
### BUGGY CODE ###

n, p = map(int, input().split())
s =list(str(input()))
s = [int(c) for c in s]
s.reverse()

if p == 2 or p == 5:
    ans = 0
    for i in range(n):
        if s[i]%p == 0:
            ans += n-1-i+1
    print(ans)
    exit()


#print(s)

#s = [0] + s
#from itertools import accumulate
#cum =list(accumulate(s))
#cum = [c%p for c in cum]

def power(a, n, mod):
  bi=str(format(n,"b")) #2進数
  res=1
  for i in range(len(bi)):
    res=(res*res) %mod
    if bi[i]=="1":
      res=(res*a) %mod
  return res

temp = 0
cum = [0]*n
for i in range(n):
    temp += s[i]*10**i
    temp += s[i]*power(10, i, p)
    temp = temp%p
    cum[i] = temp
cum = [0]+cum

#print(cum)

d = {}
ans = 0
for i in range(n+1):
  if cum[i] not in d:
    d[cum[i]] = 1
  else:
    ans += d[cum[i]]
    d[cum[i]] += 1
print(ans)


### FIXED CODE ###

n, p = map(int, input().split())
s =list(str(input()))
s = [int(c) for c in s]
s.reverse()

if p == 2 or p == 5:
    ans = 0
    for i in range(n):
        if s[i]%p == 0:
            ans += n-1-i+1
    print(ans)
    exit()


#print(s)

#s = [0] + s
#from itertools import accumulate
#cum =list(accumulate(s))
#cum = [c%p for c in cum]

def power(a, n, mod):
  bi=str(format(n,"b")) #2進数
  res=1
  for i in range(len(bi)):
    res=(res*res) %mod
    if bi[i]=="1":
      res=(res*a) %mod
  return res

temp = 0
cum = [0]*n
for i in range(n):
    temp += s[i]*power(10, i, p)
    temp = temp%p
    cum[i] = temp
cum = [0]+cum

#print(cum)

d = {}
ans = 0
for i in range(n+1):
  if cum[i] not in d:
    d[cum[i]] = 1
  else:
    ans += d[cum[i]]
    d[cum[i]] += 1
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix_3
# CreatedDate:  2020-03-23 01:25:11 +0900
# LastModified: 2020-03-23 01:38:31 +0900
#


import os
import sys


def main():
    N, K = map( int, input().split())
    P = list(map(int,input().split()))
#    print(P)
    manman=0
    for i in range(N-K+1):
        if manman<sum(P[i:(i+K)]):
            manman=sum(P[i:(i+K)])
    print((manman+K)/2)
    


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D
# CreatedDate:  2020-07-29 16:20:16 +0900
# LastModified: 2020-07-29 16:30:22 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd
from itertools import accumulate


def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    s = [(x+1)/2 for x in p]
#    print(s)
    s = list(accumulate(s))
    s.insert(0, 0)
    ans = 0
#    print(s)
    for i in range(n-k+1):
        ans = max(ans, s[i+k]-s[i])
    print(ans)



if __name__ == "__main__":
    main()
### BUGGY CODE ###

from collections import Counter
n = int(input())
s = [Counter(input()) for _ in range(n)]

c = 0
for i in range(n):
    for j in range(n):
        if s[i] == s[j] and i != j:
            c += 1
print(c//2)

### FIXED CODE ###

from collections import Counter
from scipy import misc
n = int(input())
s = [list(input()) for _ in range(n)]

ss = []
for i in range(n):
    a = sorted(s[i])
    a = ''.join(a)
    ss.append(a)

ss = Counter(ss)
ans = 0
n = len(ss)
k = ss.keys()
for i in k:
    if ss[i] == 1:
        continue
    if ss[i] >= 2:
        ans += round(float(misc.comb(ss[i],2)))
print(int(ans))
### BUGGY CODE ###

S = input()
quantity = int(input())
L = [input().split() for i in range(quantity)]
hanten = -1
for row in range(quantity):
    each = L[row]
    if each[0] == "1":
        hanten = hanten * -1
    else:
        if each[1] == "1":
            if hanten == -1:
                S = each[2] + S
            else:
                S = S + each[2]
        else:
            if hanten == -1:
                S = S + each[2]
            else:
                S = each[2] + S

if hanten == 1:
    S = S[::-1]

print(S)

### FIXED CODE ###

S = input()
quantity = int(input())
L = [input().split() for i in range(quantity)]
hanten = -1
atama = ""
shiri = ""
for row in range(quantity):
    each = L[row]
    if each[0] == "1":
        hanten = hanten * -1
    else:
        if each[1] == "1":
            if hanten == -1:
                atama = atama + each[2]
            else:
                shiri = shiri + each[2]
        else:
            if hanten == -1:
                shiri = shiri + each[2]
            else:
                atama = atama + each[2]

atama = atama[::-1]
ans = atama + S + shiri
if hanten == 1:
    ans = ans[::-1]

print(ans)
### BUGGY CODE ###

import itertools
n = input()
l = [int(i) for i in input().split()]

p = list(itertools.combinations(l,3))

ans = 0
for i in p:
    if i[0] >= i[1] + i[2]:
        pass
    elif i[1] >= i[0] + i[2]:
        pass
    elif i[2] >= i[0] + i[1]:
        pass
    else:
        ans += 1

print(ans)

### FIXED CODE ###

import bisect
n = int(input())
l = sorted([int(i) for i in input().split()])

ans = 0
for i in range(n):
    for j in range(i+1,n):
        a = l[i]
        b = l[j]
        tri = bisect.bisect_left(l,a+b)
        ans += tri-j-1
        
print(ans)
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
import sys

ans = 1
for i in range(n):
  ans *= A[i]

if ans>10**18:
    print(-1)
    sys.exit()
print(ans)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
A.sort()
import sys

if A[0]==0:
  print(0)
  sys.exit()
  
ans = 1
for i in range(n):
  ans *= A[i]
  if ans > 10**18:
    print(-1)
    sys.exit()

print(ans)
### BUGGY CODE ###

n, c = map(int, input().split())

lx, lv = [], []

for _ in range(n):
    tmpx, tmpv = map(int, input().split())
    lx.append(tmpx)
    lv.append(tmpv)

lux = [c-x for x in reversed(lx)]

#両方向の累積和
tmpv1, tmpv2 = 0,0
vc, vuc = [],[]
for i in range(n):
    tmpv1 += lv[i]
    tmpv2 += lv[n-1-i]
    _ = [x.append(y) for x,y in zip([vc,vuc],[tmpv1,tmpv2])]

sc, suc = [],[]
tmp1,tmp2 = 0,0
for i in range(n):
    sc.append(vc[i] - lx[i])
    suc.append(vuc[i] - (c - lx[n-1-i]))

ans = 0

s3,s4 = 0,0

for i in range(n):
    s1 = sc[i]
    s2 = suc[i]
    tmpv,tmpx,s3 = 0,0,0
    for j in range(n-1-i):
        s3 = max(s1 + suc[j] - min(lx[i],lux[j]),s3)
    ans = max(ans,s1,s2,s3)

print(ans)

### FIXED CODE ###

n, c = map(int, input().split())

lx, lv = [], []

for _ in range(n):
    tmpx, tmpv = map(int, input().split())
    lx.append(tmpx)
    lv.append(tmpv)

lux = [c-x for x in reversed(lx)]

#両方向の累積和
tmpv1, tmpv2 = 0,0
vc, vuc = [],[]
for i in range(n):
    tmpv1 += lv[i]
    tmpv2 += lv[n-1-i]
    _ = [x.append(y) for x,y in zip([vc,vuc],[tmpv1,tmpv2])]

sc, suc = [],[]
tmp1,tmp2 = 0,0
for i in range(n):
    sc.append(vc[i] - lx[i])
    suc.append(vuc[i] - (c - lx[n-1-i]))

ssc,ssuc = [],[]
tmp,tmpu = -c, -c
for i in range(n):
    tmp = max(tmp, sc[i])
    tmpu = max(tmpu, suc[i])
    ssc.append(tmp)
    ssuc.append(tmpu)
ans = 0

for i in range(n):
    s1 = sc[i]
    s2 = suc[i]
    if i == n-1:
        s3,s4 = 0,0
    else:
        s3 = s1 - lx[i] + ssuc[max(0,n-i-2)]
        s4 = s2 - lux[i] + ssc[max(0,n-i-2)]

    ans = max(ans,s1,s2,s3,s4)

print(ans)
### BUGGY CODE ###

import numba
from numba import jit

n = int(input())
x = input()

@jit
def popcount(ni):
    n_b = str(bin(ni))
    return n_b.count("1")

@jit
def ans(n,x):
    x_i = int(x, 2)
    x_orig = popcount(x_i)
    solve = 0
    for i in range(n):
        x_count = x_orig
        if x[i] == "0":
            solve = x_i+2**(n-i-1)
            x_count += 1
        else:
            solve = x_i-2**(n-i-1)
            x_count -= 1
        count = 0

        if solve != 0 :
            solve = solve % x_count
            count+=1

        while solve > 0:
            solve = solve % popcount(solve)
            count+=1

        print(count)

    
ans(n,x)

### FIXED CODE ###


n = int(input())
x = input()

def popcount(ni):
    n_b = str(bin(ni))
    return n_b.count("1")

def ans(n,x):
    x_i = int(x, 2)
    x_orig = popcount(x_i)
    x_i_t = x_i % (x_orig+1)
    if x_orig != 1:
        x_i_b = x_i % (x_orig-1)
    else:
        x_i_b = x_i
    solve = 0
    for i in range(n):
        x_count = x_orig
        if x[i] == "0":
            x_count += 1
            solve = x_i_t + pow(2,n-1-i,x_count)
        else:
            x_count -= 1
            if x_count != 0:
                solve = x_i_b - pow(2,n-1-i,x_count)
            else:
                print(0)
                continue
        count = 0

        if x_count != 0 :
            solve = solve % x_count
            count+=1

        while solve > 0:
            solve = solve % popcount(solve)
            count+=1

        print(count)

    
ans(n,x)
### BUGGY CODE ###


import math
n,a,b = map(int, input().split())

m = [0] * n
for i in range(n):
  m[i] = int(input())
  

m.sort()


def enough(m,a,b,T):
  cnt = 0
  for hp in m:
    if hp > b*T:
      cnt += int(math.ceil((hp - b*T)/(a-b)))
      
  return True if  cnt <= T else False

r = 10**100
#r = 30
l = 0
mid = 0

while r - l > 1:
  mid = (r+l)//2
  if enough(m,a,b,mid) == True:
    r = mid
    #print("r:",r)
  else:
    l = mid
    #print("l:",l, " r:",r)

print(r)

### FIXED CODE ###


import math
n,a,b = map(int, input().split())

m = [0] * n
for i in range(n):
  m[i] = int(input())
  

m.sort()


def enough(m,a,b,T):
  cnt = 0
  for hp in m:
    if hp > b*T:
      cnt += int(math.ceil((hp - b*T)/(a-b)))
      
  return True if  cnt <= T else False

r = 10**10
#r = 30
l = 0
mid = 0

while r - l > 1:
  mid = (r+l)//2
  if enough(m,a,b,mid) == True:
    r = mid
    #print("r:",r)
  else:
    l = mid
    #print("l:",l, " r:",r)

print(r)
### BUGGY CODE ###

N = int(input())
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n // i)
    divisors.sort()
  return divisors
l = make_divisors(N)
if len(l) % 2 == 0:
  x = l[len(l) // 2 - 1]
  y = l[len(l) // 2]
  print(x + y - 2)
else:
  x = l[len(l) // 2]
  print(2 * (x-1))

### FIXED CODE ###

N = int(input())
import math

n = math.sqrt(N)
if n.is_integer():
  x = round(n) - 1
  print(2 * x)
else:
  def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        divisors.append(i)
        if i != n // i:
          divisors.append(n // i)
    divisors.sort()
    return divisors
  l = make_divisors(N)
  if len(l) % 2 == 0:
    x = l[len(l) // 2 - 1]
    y = l[len(l) // 2]
    print(x + y - 2)
### BUGGY CODE ###

def main():
    N = int(input())
    ans = 0
    def c(i, j):
        res = 0
        str_i = str(i)
        str_j = str(j)
        for k in range(1, N+1):
            if str(k)[0] == str_i and str(k)[-1] == str_j:
                res += 1
        return res

    for i in range(1, 10):
        for j in range(1, 10):
            ans += c(i,j) * c(j, i)

    print(ans)
main()

### FIXED CODE ###

def main():
    N = int(input())
    ans = 0
    def c(i, j):
        res = 0
        str_i = str(i)
        str_j = str(j)
        for k in range(1, N+1):
            if str(k)[0] == str_i and str(k)[-1] == str_j:
                res += 1
        return res

    for i in range(1, 10):
        for j in range(1, 10):
            ans += c(i,j) * c(j, i)

    print(ans)
main()
### BUGGY CODE ###

s = input()
len_s = len(s)
mod = 10 ** 9 + 7
dp = [[0] * 13 for i in range(len_s)]
if s[-1] == '?':
    for i in range(10):
        dp[0][i] = 1
else:
    dp[0][int(s[-1])] = 1


for i in range(1, len_s):
    digits = pow(10, i)
    for j in range(13):
        if dp[i - 1][j] > 0:
            if s[-(i + 1)] != '?':
                add = int(s[-(i + 1)]) * digits
                dp[i][(j + add)%13] = (dp[i][(j + add)%13] + dp[i - 1][j])%mod
            else:
                for k in range(10):
                    # k:先頭に加える数字
                    add = k * digits
                    dp[i][(j + add) % 13] = (dp[i][(j + add) % 13] + dp[i - 1][j]) % mod

print(dp[-1][5] % mod)

### FIXED CODE ###

s=input()
len_s=len(s)
mod=10**9+7
dp=[[0]*13 for i in range(len_s)]

if s[-1]!='?':
    dp[0][int(s[-1])%13]=1
else:
    for i in range(10):
        dp[0][i]=1

a=1
for i in range(1,len_s):
    a=10*a%13
    if s[-(i+1)]!='?':
        temp_S=int(s[-(i+1)])
        amari=(temp_S*a)%13
        for j in range(13):
            dp[i][(amari+j)%13]+=dp[i-1][j]%mod

    else:
        for k in range(10):
            amari=(k*a)%13
            for l in range(13):
                dp[i][(amari+l)%13]+=dp[i-1][l]%mod
#print(*dp,sep='\n')
print(dp[-1][5]%mod)
### BUGGY CODE ###


def main():
    import time
    start_time = time.time()

    N = int(input())
    S = input()
    ok, ng = 0, N + 1
    while abs(ok - ng) > 1:
        if time.time() - start_time > 1.7:
            print(0)
            exit()

        x = (ok + ng) // 2
        for i in range(N - x + 1):
            if S.find(S[i: i + x], i + x) > 0:
                ok = x
                break
        else:
            ng = x

    print(ok)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    S = input()
    ok, ng = 0, N + 1
    while abs(ok - ng) > 1:
        x = (ok + ng) // 2
        check = set()
        for i in range(N - x + 1):
            check.add(S[i: i + x])
            if S[i + x: i + 2 * x] in check:
                ok = x
                break
        else:
            ng = x

    print(ok)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import math
X = int(input())
A=[]
B=[]
number = []
flag = 0
for i in range(math.ceil(X/10) * -1, math.ceil(X/10) + 1):
    number.append(i)
    A.append(i ** 5)
    B.append(i ** 5)

for i in range(len(A)):
    for j in range(len(B)):
        if(A[i] - B[j] == X and flag == 0):
            print(number[i],number[j])
            flag += 1

### FIXED CODE ###

X = int(input())
flag = 0
            
#Aの範囲
for i in range(-118, 119):
    for j in range(-119, 118):
        if(i ** 5 - j ** 5 == X and flag == 0):
            print(i, j)
            flag += 1