Harryxun/stf_run huggingface dataset:
N,M=map(int,input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
a=str(0)*N
A=[a[i] for i in range(len(a))]
x=0
#print(sc)
b=[]
c=[]
for i in range(M):
    if (sc[i][0] == 1) and (sc[i][1]==0) and (N!=1):
        a=-1
        break
    else:
        if (sc[i][0]) in b:#左から何桁目の情報が既にある場合、既に登録されているその桁の値と新たに登録しようとしてるその桁の値が異なるとき弾く
            if sc[i][1]!=int(c[b.index(sc[i][0])]):
                print(c[b.index(sc[i][0])])
                x=-1
                break
        else:
            A[sc[i][0]-1]=str(sc[i][1])
            b.append(sc[i][0])
            c.append(sc[i][1])
        
if b==[] and (N!=1):
    a=-1
    print(a)
elif (1 not in b) and(N!=1):
    A[0]=str(1)
    a="".join(A)
    print(a)
elif  (1 not in b) and (2 not in b):
    A[0]=str(1)
    A[1]=str(0)
    a="".join(A)
    print(a)
elif x==-1:
    print(-1)
else:
    a="".join(A)
    print(a)

### FIXED CODE ###

N,M=map(int,input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
a=str(0)*N
A=[a[i] for i in range(len(a))]
x=0
#print(sc)
b=[]
c=[]
for i in range(M):
    if (sc[i][0] == 1) and (sc[i][1]==0) and (N!=1):
        x=-1
        break
    else:
        if (sc[i][0]) in b:#左から何桁目の情報が既にある場合、既に登録されているその桁の値と新たに登録しようとしてるその桁の値が異なるとき弾く
            if sc[i][1]!=int(c[b.index(sc[i][0])]):
                #print(c[b.index(sc[i][0])])
                x=-1
                break
        else:
            A[sc[i][0]-1]=str(sc[i][1])
            b.append(sc[i][0])
            c.append(sc[i][1])
if x==-1:
    print(-1)      
elif b==[] and (N!=1):
    if N==2:
        print(10)
    elif N==3:
        print(100)
elif (1 not in b) and(N!=1):
    A[0]=str(1)
    a="".join(A)
    print(a)
elif  (1 not in b) and (2 not in b) and (N==3):
    A[0]=str(1)
    A[1]=str(0)
    a="".join(A)
    print(a)

else:
    a="".join(A)
    print(a)
ok_list= []
for al in range(10**(n-1), 10**(n)):
    ynli = []
    li = list(str(al))
    for mm in range(m):
        if li[int(sc[int(mm)][0])-1] != sc[int(mm)][1]:
            ynli.append("NO")
    if "NO" in ynli:
        pass
    else:
        ok_list.append(al)
if ok_list == []:
    print(-1)
print(min(ok_list))

### FIXED CODE ###

n, m = map(int, input().split())
sc = {}
for m2 in range(m):
    sc[m2]=input().split()
ok_list= []
for al in range(0, 10**(n)):
    ynli = []
    li = list(str(al))
    if len(li) == n:
        for mm in range(m):
            if li[int(sc[int(mm)][0])-1] != sc[int(mm)][1]:
                ynli.append("NO")
        if "NO" in ynli:
            pass
        else:
            ok_list.append(al)
    else:
        pass
if ok_list == []:
    print(-1)
else:
    print(min(ok_list))
import sys
s = input().split()
weather_forecast = s[0]
weather_real  = s[1]
weather_forecast_s = list(weather_forecast)
weather_real_s = list(weather_real)
hit = 0
for i in range(3):
    if weather_forecast_s[i] == weather_real_s[i]:
        hit+=1
print(hit)

### FIXED CODE ###

import sys
weather_forecast = input()
weather_real = input()
weather_forecast_s = list(weather_forecast)
weather_real_s = list(weather_real)
hit = 0
for i in range(3):
    if weather_forecast_s[i] == weather_real_s[i]:
        hit+=1
print(hit)
input();print(sum(int(a)-1for i in input().split()))

### FIXED CODE ###

a,b,c=sorted(map(int,input().split()));print(c-a)
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
d = [A[i+1]-A[i] for i in range(N-1)]
de = K - A[N-1] + A[0]
dis = 0
for i in range(N-2):
  dis += d[i]
if d[N-2] <= de:
  dis += d[N-2]
else:
  dis += de
print(dis)

### FIXED CODE ###

K, N = list(map(int,input().split()))
A = list(map(int,input().split()))
d = [A[i+1]-A[i] for i in range(N-1)]
de = K - A[N-1] + A[0]
d.append(de)
D = sorted(d)
dis = 0
for i in range(N-1):
  dis += D[i]
print(dis)
def py():
  x, n = map(int, input().split())
  p = list(map(int, input().split()))
  if p == []:
    print(x)
    return
  list0=[]
  for i in range(1,101):
    list0.append(i)
  for j in p:
    list0.remove(j)
  list1=[]
  for i in list0:
    list1.append(abs(x-i))
  if x-min(list1) in list0:
    print(x-min(list1))
  else:
    print(x+min(list1))
    
py()
  

### FIXED CODE ###

x, n = map(int, input().split())
p = list(map(int, input().split()))

for i in range(100):
    if not((x - i) in p):
        print (x - i)
        exit ()
    elif not((x + i) in p):
        print (x + i)
        exit()
import sys
sys.setrecursionlimit(65536)

N,M=map(int, input().split())

path=[[] for _ in range(N+1)]

for _ in range(M):
	l,r,d=map(int, input().split())
	path[l].append((r,+d))
	path[r].append((l,-d))

cost=[None for _ in range(N+1)]

def walk(i, c):
	if cost[i] is None:
		cost[i] = c
		for j,d in path[i]:
			if not walk(j, c+d):
				return False
	return cost[i] == c

ans = "Yes"

for i in range(1, N+1):
	if cost[i] is None and not walk(i, 0):
		ans = "No"
		break

print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1145141919)

N,M=map(int, input().split())

path=[[] for _ in range(N+1)]

for _ in range(M):
	l,r,d=map(int, input().split())
	path[l].append((r,+d))
	path[r].append((l,-d))

cost=[None for _ in range(N+1)]

def walk(i, c):
	if cost[i] is None:
		cost[i] = c
		for j,d in path[i]:
			if not walk(j, c+d):
				return False
	return cost[i] == c

ans = "Yes"

for i in range(1, N+1):
	if cost[i] is None and not walk(i, 0):
		ans = "No"
		break

print(ans)
def func(x):
  if ord(x) - ord('a') >= 0:
    print('a')
  else:
    print('A')


def main():
  letter = raw_input()
  func(letter)
  # for x in ['A', 'Z', 'a', 'z']:
  #   func(x)


if __name__ == '__main__':
  main()

### FIXED CODE ###

def func(x):
  if ord(x) - ord('a') >= 0:
    print('a')
  else:
    print('A')


def main():
  letter = input()
  func(letter)
  # for x in ['A', 'Z', 'a', 'z']:
  #   func(x)


if __name__ == '__main__':
  main()
N = input()
sum = 0
for n in N:
  sum += int(n)
res = int(N) % sum
if res == 0:
  print("Yes")
else
  print("No")

### FIXED CODE ###

N = input()
s = 0
for n in N:
  s += int(n)
res = int(N) % s
if res == 0:
  print("Yes")
else:
  print("No")
import numpy as np

n = int(input())
h = []
for i in range(n):
    h.append(input())

for i in range(len(hh)-1):
   if hh[i] < hh[i+1]:
       hh[i+1] -= 1
np.diff(hh-1, n=1)

minus = [i for i in np.diff(hh-1, n=1) if i < 0]

if len(minus) > 0:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

import numpy as np
 
n = int(input())
h = list(map(int, input().split()))
 
h = np.array(h)
 
for i in range(len(h)-1):
   if h[i] < h[i+1]:
       h[i+1] -= 1
np.diff(h-1, n=1)
 
minus = [i for i in np.diff(h-1, n=1) if i < 0]
 
if len(minus) > 0:
    print('No')
else:
    print('Yes')
a = int(input())
print(a+a*a)+(a*a*a)

### FIXED CODE ###

a = int(input())
print(a+(a*a)+(a*a*a))
n=int(input())
i=1
while i < 10:
  if n%i==0:
    if n/i < 10:
      print(Yes)
      i=10
  i=i+1
if i=10:
  print(No)

### FIXED CODE ###

n=int(input())
i=1
while i < 10:
  if n%i==0:
    if n/i < 10:
      print("Yes")
      i=10
  i=i+1
if i == 10:
  print("No")
n = INT()
if n%2 == 0:
    print((n-2)//2)
else:
    print((n-1)//2)

### FIXED CODE ###

n = int(input())
if n%2 == 0:
    print((n-2)//2)
else:
    print((n-1)//2)
from collections import deque

n, m, k = [int(e) for e in input().split()]
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]

lena = len(a)
lenb = len(b)
s = deque()
t = deque()

while True:
    lens = len(s)
    if lens >= lena:
        break
    e = a[lens]
    if e > k:
        break
    s.append(e)
    k -= e

while True:
    lent = len(t)
    if lent >= lenb:
        break
    e = b[lent]
    if e > k:
        break
    t.append(e)
    k -= e

while True:
    lent = len(t)
    if lent >= lenb:
        break
    lens = len(s)
    if b[lent] >= s[lens - 1]:
        break
    k += s.pop()
    while True:
        lent = len(t)
        if lent >= lenb:
            break
        e = b[lent]
        if e > k:
              break
        t.append(e)
        k -= e
    

print(len(s) + len(t))

### FIXED CODE ###

n, m, k = [int(e) for e in input().split()]
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]

i = 0
j = 0

total_max = 0

while i < n:
    if a[i] > k:
        break
    k -= a[i]
    i += 1
    
while j < m:
    if b[j] > k:
        break
    k -= b[j]
    j += 1

total_max = i + j
    
while i > 0 and j < m:
    k += a[i - 1]
    i -= 1
    while j < m:
        if b[j] > k:
            break
        k -= b[j]
        j += 1
    if total_max < i + j:
        total_max = i + j
    
print(total_max)
N  = int(input())
T = [0]*100000
X= [0]*100000
Y= [0]*100000
x = 0
y = 0

for n in range(N):
        t[n],x[n],y[n] = (map(int, input().split()))

can = True

for i in range(N):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if dt < dist:
        can = False
    if (dist % 2 != dt % 2):
        can = False

if can == True:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = int(input())
T = [0]*100000
X= [0]*100000
Y= [0]*100000
x = 0
y = 0

for n in range(N):
        T[n],X[n],Y[n] = (map(int, input().split()))

flag = 1
for n in range(N):
    #print(n)
    if flag == 0:
        continue


    if n == 0:
        count = T[n]
    else:
        count = T[n] - T[n-1]
        x = X[n-1]
        y = Y[n-1]
    c = 0
    end = 0
    while True:
        if end == 1:
            break
        s_x = X[n] - x
        s_y = Y[n] - y
    #    print(str(s_x)+' '+str(s_y))

        if ((s_x != 0 or s_y !=0) )and (c!=count):
            if s_x >0:
                x +=1
                c += 1
            elif s_x < 0:
                x -= 1
                c+=1
            elif s_y > 0:
                y +=1
                c += 1
            elif s_y < 0:
                y -= 1
                c+=1
        elif  ((s_x == 0 and s_y == 0) )and (c!=count):
                x +=1
                c +=1
        elif c==count:
            if (x == X[n] and y ==Y[n]):
                flag = 1
                end=1
            else:
                flag=0
                end =1



if flag == 1:
    print('Yes')
else:
    print('No')
n = int(input())
L = list(map(int, input().split()))

L.sort(reverse=Ture)
print(sum(L[0::2]) - sum(L[1::2]))

### FIXED CODE ###

n = int(input())
L = list(map(int, input().split()))

L.sort(reverse=True)
print(sum(L[0::2]) - sum(L[1::2]))
import sys,io
from functools import lru_cache
 
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))

### FIXED CODE ###

import sys,io
from functools import lru_cache
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
@lru_cache(None)
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))
4 3
1 2
2 3
1 4


### FIXED CODE ###

N,M=map(int,input().split())
cnt=[0 for i in range(N)]


for i in range(M):
    a,b=map(int,input().split())
    cnt[a-1]+=1
    cnt[b-1]+=1

for i in range(N):
    print(cnt[i])
#!/usr/bin/env python3

from math import *

def lcm(a,b):
    return a*(b//gcd(a,b))

n = int(input())
A = [int(x) for x in input().split()]
m = 1
for i in A:
    m = lcm(i,m)

m -= 1
ans = 0
for i in A:
    ans += m%i

print(ans)


### FIXED CODE ###

n = input()
a = input().split()
b = []
for i in a :
    b.append(int(i));
c = 0
for i in b :
    c += i-1
print(c)
raw_time = int(raw_input())
 
if 0 <= raw_time < 86400:
    hour = raw_time / 3600
    min = (raw_time - hour * 3600) / 60
    sec = (raw_time - hour * 3600 - min * 60)
    print(%d:%d:%d)%(hour, min, sec)

### FIXED CODE ###

raw_time = int(raw_input())
 
if 0 <= raw_time < 86400:
    hour = raw_time / 3600
    min = (raw_time - hour * 3600) / 60
    sec = (raw_time - hour * 3600 - min * 60)
    print("%d:%d:%d")%(hour, min, sec)
a,b,c = map( int , raw_input().split() )

if a < b < c:
  print "%s %s %s" %(a,b,c)
elif a < c < b:
  print "%s %s %s" %(a,c,b)
elif b < a < c:
  print "%s %s %s" %(b,a,c)
elif b < c < a:
  print "%s %s %s" %(b,c,a)
elif c < a < b:
  print "%s %s %s" %(c,a,b)
else c < b < a:
  print "%s %s %s" %(c,b,a)

### FIXED CODE ###

N = map( int , raw_input().split() )
 
if N[0] < N[1] < N[2] or N[0] == N[1] == N[2] or N[0] < N[1] == N[2] or N[0] == N[1] < N[2]:
  print "%d %d %d" %(N[0],N[1],N[2])
elif N[0] < N[2] < N[1]:
  print "%d %d %d" %(N[0],N[1],N[2])
elif N[1] < N[0] < N[2]:
  print "%d %d %d" %(N[1],N[0],N[2])
elif N[1] < N[2] < N[0] or N[1] < N[2] == N[0] or N[1] == N[2] < N[0]: 
  print "%d %d %d" %(N[1],N[2],N[0])
elif N[2] < N[0] < N[1] or N[2] < N[0] == N[1] or N[2] == N[0] < N[1]:
  print "%d %d %d" %(N[2],N[0],N[1])
elif N[2] < N[1] < N[0]:
  print "%d %d %d" %(N[2],N[1],N[0])
n = int(input())

else:
  print(int(n*(n-1)//2))

### FIXED CODE ###

n = int(input())

print(int(n*(n-1)//2))
h, w = map(int, input().split())
que = deque(maxlen=h * w)
next = deque(maxlen=h * w)

data = []

for ln in range(h):
    line = list(input().rstrip())
    data.append(line)
    for r, letter in enumerate(line):
        if letter == '#':
            que.append((ln, r))

count = 0

while len(que) > 0:
    count += 1
    while len(que) > 0:
        row, col = que.popleft()
        for r, c in ((row - 1, col), (row + 1, col), (row, col - 1), (row, col + 1)):
            if 0 <= r < h and 0 <= c < w and data[r][c] == '.':
                next.append((r, c))
                data[r][c] = '#'
    que, next = next, que
    next.clear()

print(count - 1)

### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
que = deque()
data = []

for ln in range(h):
    line = list(input().rstrip())
    data.append(line)
    for r, letter in enumerate(line):
        if letter == '#':
            que.append((ln, r))

count = 0
while len(que) > 0:
    count += 1
    next = deque()
    while len(que) > 0:
        row, col = que.popleft()
        for r, c in [(row - 1, col), (row + 1, col), (row, col - 1), (row, col + 1)]:
            if 0 <= r < h and 0 <= c < w and data[r][c] == '.':
                next.append((r, c))
                data[r][c] = '#'
    que = next

print(count - 1)
input(x)
print(int(x**3))


### FIXED CODE ###

x=int(input())
print(x*x*x)
A,B = (int(i) for i in input().split())

import math

def lcm(a, b):
    return a * b // gcd (a, b)

print(lcm(A,B))

### FIXED CODE ###

A,B = (int(i) for i in input().split())

import fractions

def lcm(a, b):
    #return a * b // math.gcd(a, b)
    return  a*b // fractions.gcd(a, b)

print(lcm(A,B))
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
#sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


a,b=MI()
g=math.gcd(a,b)
ans=[1]

for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.append(i)
        while g%i==0:
            g//=i
    
    
print(len(ans))


### FIXED CODE ###

from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


def gcd(a,b):
    a,b=max(a,b),min(a,b)
    if a%b==0:
        return b
    rt=gcd(a%b,b)
    return rt

a,b=MI()
g=gcd(a,b)
og=g
ans=set()
ans.add(1)



for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.add(i)
        while g%i==0:
            g//=i

x=len(ans)
if g>int(og**0.5) and og!=1:
    x+=1
    
print(x)
import sys

def gcd(a,b):
	temp = a
	if a<b:
		a=b
		b=a
	if b==0:
		return a
	c = a%b
	return gcd(b,c)


line = sys.stdin.readline().strip().split(" ")
A = int(line[0])
B = int(line[1])

print(gcd(A,B))
return

### FIXED CODE ###

import sys

def gcd(a,b):
	temp = a
	if a<b:
		a=b
		b=temp
	if b==0:
		return a
	c = a%b
	return gcd(b,c)


line = sys.stdin.readline().strip().split(" ")
A = int(line[0])
B = int(line[1])

print(gcd(A,B))
s = str(input())
t = str(input())

sd = sorted(s)
td = sorted(t, reverse=True)

ans = "No"
for i in range(len(sd)):
    if td[i] > sd[i]:
        ans = "Yes"
        break
    elif td[i] == sd[i]:
        pass
    else:
        break;

print(ans)


### FIXED CODE ###

s = str(input())
s_asc = ''.join(sorted(s))

t = str(input())
t_desc = ''.join(sorted(t, reverse=True))

if t_desc > s_asc:
    print("Yes")
else:
    print("No")
n = int(input())
inp = map(int,input().split())
inp.reverse()
print(inp[n-1])

### FIXED CODE ###

n = int(input())
inp = list(map(int,input().split()))
inp.reverse()
for i in range(n-1):
	print(inp[i]," ",sep="",end="")
print(inp[n-1])
#import math
#N=int(input())
A,B = map(float,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
A=int(A)
B=Decimal(B*100)
c=A*B
c=str(c//100)
print(c)


### FIXED CODE ###

#import math
#N=int(input())
A,B = map(float,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
A=int(A)
B=round(B*100)
c=A*B
c=str(c//100)
print(c)
Q, H, S, D, N = input(), input(), input(), input(), input()
if Q*2 > H:
    M1 = H
else:
    M1 = Q*2

if  M1*2 > S:
    M = S
else:
    M = M1*2
if M*2 < D:
    print(M*N)
else:
    if N%2 == 0:
        print(D*(N//2))
    else:
        print(D*(N//2) + M)


### FIXED CODE ###

Q, H, S, D,= map(int, raw_input().split())
N = int(input())
if Q*2 > H:
    M1 = H
else:
    M1 = Q*2

if  M1*2 > S:
    M = S
else:
    M = M1*2
if M*2 < D:
    print(M*N)
else:
    if N%2 == 0:
        print(D*(N//2))
    else:
        print(D*(N//2) + M)
from bisect import bisect_left
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

LIS = [1]
n, *A = map(int, read().split())

for a in A:
    a *= -1
    if LIS[-1] <= a:
        LIS.append(a)
    else:
        LIS[bisect_right(LIS, a)] = a
print(len(LIS))


### FIXED CODE ###

from bisect import bisect_left, bisect_right
from collections import deque
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
infi = 10 ** 20

# 長さがi+1のときの最長部分増加列の末尾の最小値。
n, *A = map(int, read().split())
LIS = deque([10 ** 10])
for a in A:
    a *= -1
    pos1 = bisect_left(LIS, a)
    pos2 = bisect_right(LIS, a)
    if LIS[-1] <= a:
        LIS.append(a)
    else:
        if LIS[pos1] == a:
            LIS[pos2] = a
        else:
            LIS[pos1] = a

print(len(LIS))
S=list(str(input()))
A=["A","T","G","C"]
print(S)
cnt=0
ans=[]
for (i,s) in enumerate(S):
    if s in A:
        cnt+=1
    else:
        ans.append(cnt)
        cnt=0
print(max(ans))

### FIXED CODE ###

S=input()
n=len(S)
ans=0
for i in range(n):
    for j in range(i,n):
        if all('ACGT'.count(c)==1 for c in S[i:j+1]):
            ans=max(ans,j-i+1)
print(ans)
n = int(input)
a = map(int, input().split())
print(min(a), max(a), sum(a))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
print(min(a), max(a), sum(a))
def d(n):
  return len(str(n))

N=int(input())
i=1
#print(int(N**0.5))
while N%(int(N**0.5)-i)!=0:
  i=i+1
print(max(d(int(N**0.5)-i),d(N//(int(N**0.5)-i))))

### FIXED CODE ###

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

N=int(input())
if N==1:
  print(1)
else:
  i=0
  #print(int(N**0.5))
  while N%(int(N**0.5)-i)!=0:
    i=i+1
  print(max(d(int(N**0.5)-i),d(N//(int(N**0.5)-i))))
N, Q = list(map(int, input().split()))
S = input()
l = [0] * Q
r = [0] * Q
for x in range(Q):
    l[x], r[x] = list(map(int, input().split()))

isAC = [0] * len(S)
for x in range(len(S) - 1):
    if S[x] == "A" and S[x + 1] == "C":
        isAC[x] = 1

for x in range(Q):
    ans = 0
    cut_isAC = isAC[l[x] - 1:r[x] - 1]
    for y in range(len(cut_isAC)):
        ans += cut_isAC[y]
    print(ans)


### FIXED CODE ###

b = input()
tmp = {'A':'T', 'T':'A', 'G':'C', 'C':'G'}
print(tmp[b])
first_input = list(map(int, input().split()))
number = first_input[0]
steps = first_input[1]

scaffolds = list(map(int, input().split()))

start_cost = scaffolds[0]

costs = [start_cost for i in range(number)]

for i in range(number):
    next_step = i
    next_scaffold = scaffolds[next_step]
    target_cost = -1
    for j in range(steps):
        
        last_step = next_step - (j + 1)
        if -1 < last_step:
            cost = abs(scaffolds[next_step] - scaffolds[last_step]) + costs[last_step]
            if target_cost < cost
            target_cost = cost

    if 0 < len(target_cost):
        next_cost = target_cost
    else:
        next_cost = scaffolds[next_step]

    if -1 < next_cost:
        costs[i] = next_cost

print(costs[number - 1] - start_cost)

### FIXED CODE ###

first_input = list(map(int, input().split()))
number = first_input[0]
steps = first_input[1]

scaffolds = list(map(int, input().split()))

start_cost = scaffolds[0]

costs = []

for i in range(number):
    next_step = i
    next_scaffold = scaffolds[next_step]
    target_cost = -1
    for j in range(steps):
        
        last_step = next_step - (j + 1)
        if -1 < last_step:
            cost = abs(scaffolds[next_step] - scaffolds[last_step]) + costs[last_step]
            if target_cost == -1 or cost < target_cost:
                target_cost = cost

    if 0 < target_cost:
        next_cost = target_cost
    else:
        next_cost = scaffolds[next_step]

    
    costs.append(next_cost)

print(costs[number - 1] - start_cost)