peterverebics/CodeNet_Python_118 huggingface dataset:
from collections import defaultdict

n, m = map(int, input().split())
sc = [map(int, input().split()) for _ in range(m)]

number = defaultdict(int)
for s, c in sc:
    if s in number and c != number[s]:
        print(-1)
        exit()
    number[s] = c

res = str(int(''.join([str(number[i + 1]) for i in range(n)])))

if len(res) == n:
    print(res)
else:
    print(-1)
N, M = map(int,input().split())

sc = {}
f = True
for i in range(M):
  s, c = map(int,input().split())
  if N > 1 and s == 1 and c == 0:
    print(-1)
    f = False
    break
  if s not in sc:
    sc[s] = c
  else:
    if sc[s] == c:
      continue
    else:
      print(-1)
      f = False
      break

if f:
  s = ''
  for i in range(1,N+1):
    if i in sc:
      s += str(sc[i])
    else:
      s += str(0)
  print(s)
n, m = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(m)]

NUM = [0] * n
for s, c in SC:
    if (s == n-1) and (c == 0):
        print(-1)
        exit()

    if NUM[n - s] == 0:
        NUM[n - s] = c
    elif (NUM[n - s] != 0) and (NUM[n - s] != c):
        print(-1)
        exit()

if NUM[n - 1] == 0:
    print(-1)
    exit()

for s in NUM[::-1]:
    print(s, end="")
# coding: utf-8
# Your code here!

line = input().split(" ")
n = int(line[0])
m = int(line[1])

result = ["0"] * n
out = 0

for i in range(m):
    line = input().split(" ")
    # print(line)
    line_n = int(line[0])
    # line_m = int(line[1])
    if result[line_n - 1] == "0":
        result[line_n - 1] = line[1]
    elif result[line_n - 1] != line[1]:
        out = -1
    
if result[0] == "0":
    out = -1
print(result)
if out == 0:
    print("".join(map(str,result)))
else:
    print(out)
N, M = list(map(int, input().split()))
sc = [list(map(int, input().split())) for i in range(M)]

answer = [None] * N
for si, ci in sc:
    digit = si - 1
    if answer[digit] is not None and answer[digit] != ci:
    # if answer[digit] != ci:
        print('-1')
        exit()
    
    answer[digit] = ci

if answer[0] == 0 and N != 1:
    print('-1')
    exit()

if answer[0] is None:
    answer[0] = 1

for i, value in enumerate(answer):
    if answer[i] is None:
        answer[i] = 0

answer = int(''.join(map(str, answer)))
print(answer)
N,M = map(int,input().split())
SC = [tuple(map(int,input().split())) for i in range(M)]

if N==1:
    r = range(10)
elif N==2:
    r = range(10,100)
else:
    r = range(100,1000)
for n in r:
    print(n)
    n = str(n)
    for s,c in SC:
       #print("s=",s,"c",c)
        if n[s-1] != str(c):
            break
    else:
        print(n)
        exit()
print(-1)
N,M = map(int, input().split())

a_list = [0] * N

uncorrect = 0

for i in range(M):
    s,c = map(int, input().split())
    if a_list[s-1] == 0:
        a_list[s-1] += c
    else:
        if a_list[s-1] != c:

            uncorrect += 1

if uncorrect >= 1:
    print(-1)
elif a_list[0] == 0 and N > 2:
    print(-1)
else:
    ans = 0
    for i in range(N):
        ans += a_list[i] * (10 ** (N-i-1))

    print(ans)
def main():
  N, M = map(int,input().split())
  sc = list(list(input().split()) for _ in range(M))

  li = [""] * N

  for i in range(M):
    j = li[int(sc[i][0]) - 1]
    if j == "": li[int(sc[i][0]) - 1] = sc[i][1]
    else:
      if j != sc[i][1]: return -1

  for i in range(N):
    if i == 0:
      if li[0] == "0": return -1
      if li[0] == "": li[0] = "1"
    elif li[i] == "": li[i] = "0"

  return "".join(li)

print(main())
info = [int(n) for n in input().split()]

number = [0, 0, 0]
answer = 0

for i in range(info[1]):
  n = [int(n) for n in input().split()]
  target_number = number[n[0]- 1]
  if target_number is 0:
    number[n[0]- 1] = n[1]
  else:
    if target_number != n[1]:
      answer = -1
      print(answer)
      break

if answer != -1:
  answer = number[0]*100 + number[1]*10 + number[2]
  print(answer)
N,M = map(int,input().split())

result = [0] * N

for m in range(M):
    s,c = map(int,input().split())
    if N>=2 and s == 1 and c == 0:
        print(-1)
        exit()
    if result[s-1] == 0:
        result[s-1] = c
    else:
        if result[s-1] == c:
            continue
        else:
            print(-1)
            exit()

if result[0]==0:
    result[0] = 1

a = ""
for i in result:
    a += str(i)
print(int(a))
import sys
N, M = map(int, input().split())
ls = ['' for i in range(N)]

for i in range(M):
    s, c = map(int, input().split())
    if ls[s-1] == '':
        ls[s-1] = str(c)
    elif ls[s-1] != str(c):
        print(-1)
        sys.exit()

if ls[0] == '0' and len(ls) == 1:
    print(0)
    sys.exit()
elif ls[0] == '0' and len(ls) != 1:
    ls[0] = '1'

ans = ''
for x in ls:
    if x != '':
        ans += x
    else:
        ans += '0'
print(ans)
n,m = map(int, input().split())
nums = {}
flg = False
for i in range(m):
    key,val = input().split()
    if key in nums.keys() and val != nums[key]:
        flg = True
        break
    else:
        nums[key] = val

if flg:
    print(-1)
else:
    output = ""
    for i in range(1, n + 1):
        if i == 1 and n > 1:
            nums.setdefault(str(i), "1")
        else: 
            nums.setdefault(str(i), "0")
        output = output + nums.get(str(i))
    print(output)
N,M = map(int,input().split())

ans = ["1"] + ["0"] * (N - 1)
default = "1" + "0" * (N - 1)

for i in range(M):
  s,c = input().split()
  s = int(s) - 1
  if N > 1 and s == 0 and c == "0":
    print(-1)
    exit(0)
  if ans[s] == default[s] or ans[s] == c:
    ans[s] = c
  else:
    print(-1)
    exit(0)
     
print("".join(ans))
import math
N,K=map(int,input().split())

ans = int(math.log(N,K)+1)

print(ans)
n,k=map(int, input().split())
ans=1
while 1:
  n//=k
  if n>0: ans+=1
  else: break
print(ans)
n,k = map(int, input().split())

ans = 0

while n > 0:
  n /= k
  n = int(n)
  ans += 1
  
print(ans)
n,k=map(int,input().split())
cnt=0
while n>0:
	n//=k
	cnt+=1
print(cnt)
N, K = list(map(int, input().split(' ')))
count = 1
com_val = K
while com_val <= N:
    count += 1
    com_val = pow(K, count)
print(count)
N, K = [int(x) for x in input().split()]

l = []

while N > 0:
    l.insert(0, N % K)
    N = N // K

print(len(l))
N,K=map(int,input().split())
i=0
while N>0:
  N=N//K
  i+=1
print(i)
import math
n, k = map(int, input().split())
print(1+math.floor(math.log(n, k)))
n, k = map(int, input().split())


def base_10_to_n(X, n):
    if (int(X/n)):
        return base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

rslt = base_10_to_n(n, k)

print(len(rslt))
n,k = map(int,input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
ans=Base_10_to_n(n,k)
print(len(ans))
n, k = map(int, input().split())
count = 1

while n // k > 0:
    n = n // k
    count += 1
print(count)
N,K=map(int,input().split())
for i in range(10**18):
    if K**i<=N<K**(i+1):
        print(i+1)
        break
a,b=list(map(int, input().split()))
from math import log
if True:
  print(int(log(a,b)+1))
from math import log10
n,k=map(int,input().split())
m=int(log10(n)/log10(k))
print(m+1)
# -*- coding: utf-8 -*-

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

def f(x, n):
    if int(x / n):
        return f(int(x / n), n) + str(x % n)
    return str(x % n)

ans = f(N, K)
print(len(ans))
N, K = map(int, input().split())
count = 0

while N >= K ** count:
  count += 1

print(count)
N, K = map(int, input().split())

count = 0
N_K = 1
while N >= N_K:
    count += 1
    N_K *= K

print(count)
n,k = list(map(int,input().split()))
count = 1

while True:
    if n < k ** count:
        break
    else:
        count += 1

print(count)
N,K = map(int, input().split())

count = 0
while N>0:
    N = N//K
    count = count + 1
print(count)
n,k=map(int, input().split())
result = 0
while n != 0:
    result+=1
    n//=k
print(result)
N, K = map(int, input().split())
digits = 0
while(N > 0):
    N = N//K
    digits = digits+1
print(digits)
n,k = map(int,input().split())
i = 0
if n == 0:
    print(1)
    exit()
else:
    while k ** i <= n:
        i += 1

print(i)
n,k = map(int,input().split())
ans = 1
while n >= k**ans:
    ans += 1
print(ans)
a = input().split()
a=[int(i) for i in a]
n,k=a[0],a[1]
r=0
b=1
while r<1:
    if n>=k**b:
        b=b+1
    else:
        r=1
print(b)
N,K = map(int, input().split())
p = 0
while True:
    if N < K**p:
        break
    p += 1
print(p)
N,K = list(map(int,input().split()))
a = 1
for i in range (1000000000):
    N = N//K
    if N == 0:
        print(a)
        break
    else:
        a = a + 1
N, K = map( int, input().split() )
import math

print( math.floor( math.log( N, K ) ) + 1 )
N,K = map(int,input().split())
conv =""

def ten_to_K(N,K,conv):
  if N // K == 0:
    conv += str(N % K)
    return conv
  else:
    N = N // K
    conv += str(N % K)
    return ten_to_K(N,K,conv)

ans = ten_to_K(N,K,conv)
print(len(ans))
# coding: utf-8
N, K = map(int, input().split())

i = 0
while N > 0:
    N = N // K
    i += 1

print(i)
n, k = map(int, input().split())

cur = 1
while n // (k ** cur) > 0:
    cur += 1
print(cur)
import math
N,K = map(int,input().split())
x = math.log(N,K)+0.0000000000001

print(math.ceil(x))
import math

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

digit = math.log(n, k)

if digit.is_integer():
    print(int(digit)+1)
else:
    print(math.ceil(digit))
N, K = map(int, input().split())
cnt = 0

while N > 0:
    N = N // K
    cnt += 1
    
print(cnt)
n, k = map(int, input().split())
count = 0

while n >= k:
  n = n//k
  count += 1
  
print(count+1)
n,r=map(int,input().split())
b=1
while n//r!=0:
    n//=r
    b+=1
print(b)
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
  n, k = na()

  def Base_10_to_n(X, n):
    if (int(X/n)):
      return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
  
  print(len(Base_10_to_n(n, k)))

if __name__ == '__main__':
  main()
n,k = map(int, input().split())
y = []
while n>=1:
    y.append(n%k)
    n = int(n/k)
y.reverse()
print(len(y))
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 product, combinations,permutations
from copy import deepcopy
import sys
sys.setrecursionlimit(4100000)



if __name__ == '__main__':
    N, K = map(int, input().split())
    cnt = 0
    while N!=0:
        N //= K
        cnt += 1
    print(cnt)
n,k=map(int,input().split());a=0
while n:n//=k;a+=1
print(a)
def Digits(N, K):
  if not N:
    return 1
  digits = 0
  while N:
    N = N // K
    digits += 1
  return digits
 
N, K = map(int, input().split())
print (Digits(N, K))
n,k = map(int, input().split())
for i in range(32):
    if k**i <= n < k**(i+1):
        print(i+1)
        break
n, k = (int(x) for x in input().split())
a = 0
while True:
    if k ** a > n: break
    else: a += 1
if a == 0: a += 1
print(a)
n, k = map(int, input().split())
a = 1
ans = 1

while n >= k**a:
    ans += 1
    a += 1

print(ans)
import sys
import math
import itertools
from collections import deque
import copy
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()

N, K = map(int, input().split())
print(int(((math.log(N, K)) // 1) + 1))
n, k = map(int,input().split())
for i in range(0,n):
    if n == 1:
        print(1)
    elif k**i > n:
        print(i)
        break
n, k = map(int, input().split())
result = ''
while n != 0:
    result = str(n % k) + result
    n = n // k
result = int(result)
i = 0
while  result / 10 ** i >= 1:
    i += 1
print(i)
n, k = map(int, input().split())
i = 0
while (n >= k):
    n = n / k
    i = i + 1
if (n != 0):
    i = i + 1    
print(i)
n, k = map(int, input().split())

count = 0
while n > 0:
    n = n // k
    count += 1

print(count)
n,k=map(int,input().split());print(sum(n>=k**i for i in range(100)))
def base10toK_base(num, K):
    if num // K:
        return base10toK_base(num//K, K) + str(num % K)
    return str(num % K)

N, K = map(int, input().split())
ans = len(base10toK_base(N, K))
print(ans)
N, K = map(int, input().split())
for i in range(10000):
	if N//(K**i) >= K:
	  	continue
	else:
  		print(i+1)
  		exit(0)
#template
def inputlist(): return [int(j) for j in input().split()]
def listinput(): return input().split()
#template
def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)
N,K = inputlist()
print(len(base10to(N,K)))
N, K = map(int,input().split())

counter = 1
while N >= K:
    N = N/K
    counter = counter + 1

print(counter)
import math  
def findNumberOfDigits(n, b): 
    dig = (math.floor(math.log(n) /math.log(b)) + 1) 
    return dig
n, k = map(int, input().strip().split())
print(findNumberOfDigits(n, k))
N, K = map(int, input().split())

i = 0
while True:
    if N < K**i:
        print(i)
        exit()
    i += 1
n,k=map(int,input().split())
a=0
while n:
  n=n//k
  a+=1
print(a)
N,K=map(int,input().split())
hey=N
ans=1
while hey >= K:
    ans += 1
    hey = hey//K
print(ans)
n,k=map(int,input().split())
cnt=0
while n:
    cnt+=1
    n//=k
print(cnt)
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X % n)
    return str(X % n)


N, K = list(map(int, input().split()))
ans = Base_10_to_n(N, K)
print(len(ans))
import math
n, k = map( int, input().split() )
print( int( math.log( n, k ) ) + 1 )
n,k = map(int, input().split())
a = n
cnt = 1
while a>=k:
    a = a//k
    cnt += 1

print(cnt)
n,k = map(int,input().split())

for i in range(10**9):
  if n < k**i:
    print(i)
    exit()
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n,k = nm()
cnt = 0
while n:
    cnt += 1
    n //= k
print(cnt)
n, k =list(map(int, input().split()))
l = []
while True:
    l.append(n % k)
    n = n // k
    if n == 0:
        break
ans = len(l)
print(ans)
N, K = map(int, input().split())

cnt = 1
while(True):
    if N // (K**cnt) < 1:
        break
    cnt += 1
print(cnt)
n,k = map(int,input().split())
c = k
t = 1
while  c<=n  :
    c*=k
    t+=1
print(t)
nt,kt = input().split()
n = int(nt)
k = int(kt)
i = 1
while n >= (k ** i):
  i = i+1
    
print(i)
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n) + out
        X_dumy = int(X_dumy / n)
    return out

N, K = list(map(int, input().split()))

print(len(Base_10_to_n(N, K)))
n,k = map(int, input().split())
ans = 0

while True:
    n //= k
    ans += 1
    if n == 0: break

print(ans)
N,K = map(int,input().split())

count = 0

while N > 0:
    N = N // K 
    count += 1

print(count)
n, k = map(int, input().split())
c = 0
while n != 0:
    n //= k
    c += 1
print(c)
N, K = [int(v) for v in input().strip().split()]

cnt = 0
while True:
    cnt += 1
    N = N // K
    if N == 0:
        break
print(cnt)
n,k = map(int,input().split())

def func(n,k):
    count = 0
    while True:
        if n / k >= 1:
            n //= k
            count += 1
        else:
            break
    return count + 1

print(func(n,k))
import math

N, R = map(int, input().split())
X = math.log(N + 0.000001, R)
Y = math.ceil(X)

print(Y)
n, k = map(int, input().split())
i = 0
while n >= k ** i:
    i += 1
print(i)
import sys

input = sys.stdin.readline

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

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

print(len(Base_10_to_n(N, K)))
N,K= map(int, input().split())
A = 0
cnt = -1
if N <= K-1:
    print(1)
else:
    while N > A:
        cnt += 1
        A = K**(cnt+1)-1
    print(cnt+1)
import math
N,K=map(int,input().split())
A=math.log(N,K)
print(int(A)+1)
N, K = list(map(int, input().split()))


def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

print(len(Base_10_to_n(N,K)))
n,k = map(int,input().split())
def func_10_to_k(X, n):
    if (int(X/n)):
        return func_10_to_k(int(X/n), n)+str(X%n)
    return str(X%n)
r = func_10_to_k(n,k)
print(len(r))
N, K=map(int,input().split())

n=N
count=0

while n>0:
    n=int(n/K)
    count+=1

print(count)
n, k = [int(w) for w in input().split()]

d = 0
while n != 0:
    n //= k
    d += 1

print(d)
N, K = (int(x) for x in input().split())

D = 0

while N > 0:
    N //= K
    D += 1

print(D)
N,K=map(int,input().split())
count=0
while N!=0:
    N=N//K
    count+=1
print(count)
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
def main():
    N,K = map(int,input().split())
    print(len(str(Base_10_to_n(N,K))))
main()
[N, K] = [int(i) for i in input().split()]

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

print(len(Base_10_to_n(N, K)))
n,k = map(int,input().split())

count = 1

while n >= k:
    n = n/k
    count += 1

print(count)
N, K = map(int, input().split())
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

print(len(Base_10_to_n(N, K)))
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy


#X = str(input()).split()
#a = [int(x) for x in input().split()]


NK = str(input()).split()
N = int(NK[0])
K = int(NK[1])
ans = 1

for i in range(N):
  if(N<K**i):
    ans = i
    break

if(N<=K):
  ans = 1


print(ans)
N,K = map(int,input().split())
if N == 0 or N == 1:
    print(1)
for i in range(1,100):
    if K**i <= N < K**(i+1):
        print(i+1)
        break
n, k = map(int, input().split())

for i in range(10000):
    while k**i > n:
        print(i)
        exit()
n,k = map(int,input().split())
i = 0
while n > 0:
    n = n//k
    i += 1
print(i)
def actual(n, k):
    """10進数のnをk進数に変換してその桁数を返す"""

    # 文字列で考えていく方が楽 
    s = ''
    
    while True:
        n, y = divmod(n, k)

        s += str(y)

        if n == 0:
            num_as_k = s[::-1]  # 不要だけど一応やっとく

            return len(num_as_k)

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

print(actual(n, k))
import math
n,k = map(int,input().split())


print(int(math.log(n,k))+1)
def f(N,K):
    if N<K:
        return 1
    return f(N//K,K)+1

N,K=map(int,input().split())
print(f(N,K))
N,K = map(int,input().split())

ans = 1
while N >= K:
    ans += 1
    N = N // K

print(ans)
N, K = map(int,input().split())

qs = []

q,mod = divmod(N,K)
qs.append(mod)
while q != 0:
    q,mod = divmod(q,K)
    qs.append(mod)
    
print(len(qs))
N,K=map(int,input().split())
c=1
while (N//K)>0:
  c = c + 1
  N = N//K
print(c)
N,K=map(int, input().split()) 
for i in range(8000):
    if K**i<=N<K**(i+1):
        print(i+1)
n, k = map(int, input().split(" "))

keta = 1
sum = 0
while True:
    max = k**keta-1
    if max >= n:
        print(keta)
        break
    keta += 1
N, K = map(int, input().split())
ans = 0
while N != 0:
    N = N // K
    ans += 1
print(ans)
n,k=map(int,input().split())
ans=1
while n>=k:
  n=n//k
  ans+=1
print(ans)
N, K = (int(x) for x in input().split())
ans=0
while(N>=1):
  N = int(N/K)
  ans+=1

print(ans)
N,K = map(int,input().split())
count = 0

while N//K != 0:
    N = N//K
    count += 1
print(count+1)
N, K = map(int, input().split())

count = 1

while N//K != 0:
    N //= K
    count += 1

print(count)
def main():
	n,m = map(int,input().split())
	ans = 1
	while n >= m:
		n = (n-n%m) // m
		ans += 1
	print(ans)

if __name__ == '__main__':
	main()
count = 0       #初期値を0とするcount変数を作る.
n,k = map(int,input().split())      #整数とn進数を入力する。

while n > 0:         #nをkで割った商が0になるまでcountに1を足し続ける。
    count += 1
    n //= k

print(count)
N,K = map(int, input().split())
i = 1
while i > 0:
    if N - pow(K, i) < 0:
        print(i)
        break
    else:
        i += 1
# ABC 156: B – Digits
N, K = [int(s) for s in input().split()]

digits = 1

while N >= K:
    digits += 1
    N //= K

print(digits)
n, k = map(int, input().split())
import math

print(math.floor(math.log(n, k)) + 1)
N ,K = map(int, input().split())
count = 0
for i in range(10**9):
    if N == 0:
        break
    N = N//K
    count += 1
print(count)
import math
N, K = map(int, input().split())
print(int(math.log(N, K))+1)
N,R=map(int,input().split())
num=0
while N>=R:
    N=N/R
    num+=1
print(num if N==0 else num+1)
N, K = map(int, input().split())

import math
n = math.log(N, K)
print(int(n) + 1)
import math

N, K = map(int, input().split())
print(int(math.log(N, K) + 1))
n,k = map(int,input().split())
tempk = k
ans = 1
while 1:
    if tempk<=n:
        ans+=1
        tempk*=k
        
    else:
        break



print(ans)
[N,K] = list(map(int,input().split()))
if N<K:
    print(1)
else:
    i=N
    j=0
    while i>=K:
        i = i/K
        j=j+1
    print(j+1)
N, K = map(int, input().split())
digits = 0
while(N > 0):
    N //= K
    digits += 1
print(digits)
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)


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

if k == 10:
    print(len(str(n)))
else:
    print(len(Base_10_to_n(n,k)))
x,n = map(int,input().split())
i = 0
while x >= n ** i:
  i += 1
  
print(i)
n,k = map(int, input().split())
cnt=0

while(n>=1):
    n /= k
    cnt += 1
print(cnt)
import numpy as np
import math

n,k = str(input()).split()
if int(n) == 0:
    print(1)
else:
    ans = np.log(int(n))/np.log(int(k))
    print(int(ans)+1)
N, K = map(int, input().split())

ans = 1
while K ** ans <= N:
    ans += 1

print(ans)
n, k = map(int, input().split())

x = 1
while k**x <= n:
  x += 1
  
print(x)
N, K = [int(_) for _ in input().split()]
for a in range(0, 10**9):
    if K**(a) <= N < K**(a+1):
        print(a+1)
        break
N, K = map(int, input().split())

result = 0
while N > 0:
    N //= K
    result += 1

print(result)
n, k = map(int, input().split())
ans = 0
while n > 0:
    n = n // k
    ans += 1
print(ans)
N,K = map(int, input().split())
 
counter = 1
tmp = 1
while True:
    tmp *= K
    if tmp > N:
        break
    counter += 1
print(counter)
n,k=map(int,input().split())

ans=0
while n!=0:
  ans+=1
  n//=k

print(ans)
import math
x,y = map(int ,input().split())
m = math.ceil(math.log(x, y))
if m == 0 :m=m+1
print(m)
n,k = map(int, input().split())
s = 1
c = 0
while n//s > 0:
  s *= k
  c += 1
print(c)
n,k=map(int,input().split())
 
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

x10=n
x2=Base_10_to_n(x10, k)
print(len(x2))
import math
N, K = map(int,input().split())
print(math.floor(math.log(N, K)) + 1)
n, k  =  map(int,input().split())

if n == 1:
    print(1)
else:
    a=1
    ans = 0
    while a<=n:
        a *=k
        ans += 1

    print(ans)
N,K=map(int,input().split())
x=0
while N:
  N//=K
  x+=1
print(x)
a,b=map(int, input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
 
x10 = a
c = Base_10_to_n(a,b )
print( len(c) )
def L():
  return list(map(int, input().split()))
import math
[n,k]=L()

print(math.floor(math.log(n,k))+1)
import math
n, k = list(map(int, input().split()))
if n == 1:
    print(1)
else:
    print(math.ceil(math.log(n, k)))
def main():
    N, K = map(int, input().split())
    ans = 0
    while N > 0:
        N //= K
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()
def toStr(n,base):
    convertString = "0123456789ABCDEF"
    if n < base:
        return convertString[n]
    else:
        return toStr(n//base,base) + convertString[n%base]

a,b = map(int,input().split())
print(len(toStr(a,b)))
line = input().split(" ")

N, K = int(line[0]), int(line[1])

ans = 0
while N > 0:
	N //= K
	# print(N, K)
	ans += 1

print(ans)
n,k = list(map(int,input().split()))
cnt=0
while n>0:
    n=n//k
    cnt+=1

print(cnt)
N, K = map(int, input().split())
l = []
while N // K != 0:
  l.insert(-1, N % K)
  N = N // K
l.append(N)
print(len(l))
# -*- coding: utf-8 -*-
"""
Created on Thu May  7 21:59:58 2020

@author: shinba
"""
N,K = map(int,input().split())

ans= 0

while N>0:
    N = N//K
    ans += 1
    
print(ans)