Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
from math import acos, cos, sin

# %%
N, K = map(int, readline().split())
m = map(int, read().split())
XYC = zip(m, m, m)
X, Y, C = zip(*XYC)
X = [complex(x, y) for x, y in zip(X, Y)]


# %%
def cross_pts(x1, r1, x2, r2):
    D = abs(x1 - x2)
    if r1 + r2 <= D:
        return
    if abs(r1 - r2) >= D:
        return
    theta = acos((r1 * r1 + D * D - r2 * r2) / (2 * r1 * D))
    z = complex(cos(theta), sin(theta)) * r1 / D
    yield x1 + (x2 - x1) * z
    yield x1 + (x2 - x1) * z.conjugate()


# %%
def test(cost):
    R = [cost / c for c in C]

    def gen_y():
        for i in range(N):
            yield X[i].imag - R[i]
            yield X[i].imag + R[i]
        for i, j in itertools.combinations(range(N), 2):
            for x in cross_pts(X[i], R[i], X[j], R[j]):
                yield x.imag
    Y = sorted(gen_y())
    for y1, y2 in zip(Y, Y[1:]):
        y = (y1 + y2) / 2
        event = []
        for i in range(N):
            if R[i] < abs(X[i].imag - y):
                continue
            dx = (R[i] ** 2 - (X[i].imag - y) ** 2) ** .5
            event.append((X[i].real - dx, 1))
            event.append((X[i].real + dx, -1))
        event.sort()
        n = 0
        best_n = 0
        for _, dn in event:
            n += dn
            if n > best_n:
                best_n = n
        if best_n >= K:
            return True
    return False


# %%
left = 0
right = 10 ** 7
for _ in range(100):
    x = (left + right) / 2
    if test(x):
        right = x
    else:
        left = x
print(right)


### FIXED CODE ###

import sys
from cmath import rect
import numpy as np
import numba
from numba import njit
i8 = numba.int64

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

eps = 1e-9

@njit((numba.complex128, numba.float64) * 2, cache=True)
def cross_circles(c1, r1, c2, r2):
    d = abs(c1 - c2)
    if d <= abs(r1 - r2) or r1 + r2 <= d:
        return None
    cos_theta = (r1 * r1 + d * d - r2 * r2) / (2 * r1 * d)
    theta = np.arccos(cos_theta)
    z1 = (c2 - c1) * rect(r1 / d, theta)
    z2 = (c2 - c1) * rect(r1 / d, -theta)
    return (c1 + z1, c1 + z2)

@njit
def test(Z, C, t):
    R = t / C
    cand = list(Z)
    for j in range(len(Z)):
        for i in range(j):
            points = cross_circles(Z[i], R[i], Z[j], R[j])
            if points is not None:
                for p in points:
                    cand.append(p)
    cand = np.array(cand)
    cnt = np.zeros(len(cand), np.int64)
    for i in range(len(Z)):
        cnt += np.abs(cand - Z[i]) <= R[i] + eps
    return np.any(cnt >= K)

N, K = map(int, readline().split())
nums = np.array(read().split(), np.float64)

Z = nums[::3] + 1j * nums[1::3]
C = nums[2::3]

l = 0
r = 10**9
for _ in range(100):
    m = (l + r) / 2
    if test(Z, C, m):
        r = m
    else:
        l = m

print(r)
n,m = map(int,input().split())
h_list = [int(i) for i in input().split()]
data = [list(map(int, input().split())) for _ in range(m)]

ten_set =set(np.array(range(1,n+1)))
ans_set =set([])
exist_set = set(np.array(range(1,n+1)))
for i in range(m):
    if h_list[data[i][0]-1] < h_list[data[i][1]-1]:
        ans_set.add(data[i][1])
        if data[i][0] in ans_set:
            ans_set.remove(data[i][0])
    elif h_list[data[i][0]-1] > h_list[data[i][1]-1]:
        
        ans_set.add(data[i][0])
        if data[i][1] in ans_set:
            ans_set.remove(data[i][1])
    elif h_list[data[i][0]-1] == h_list[data[i][1]-1]:
        if data[i][0] in ans_set:
            ans_set.remove(data[i][1])
        if data[i][1] in ans_set:
            ans_set.remove(data[i][1])
    exist_set.add(data[i][0])
    exist_set.add(data[i][1])

sa_set = ten_set − exist_set
ans_set = ans_set.union(sa_set)
print(len(ans_set))

### FIXED CODE ###

s = input()
if s == 'ARC':
    print('ABC')
else:
    print('ARC')
S = input()

if S == "Sunny"
    print("Cloudy")
elif S == "Cloudy"
    print("Rainy")
else:
    print("Sunny")

### FIXED CODE ###

S = input()

if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
def main(n,ab,px):
  g=[[]for _ in range(n+1)]
  for a,b in ab:
    g[a].append(b)
    g[b].append(a)
  ans=[0]*n
  for p,x in px:
    ans[p-1]+=x
  
  def dfs(seen,i):
    seen[i-1]=1
    l=g[i]
    for li in [li for li in l if seen[li-1]==0]:
      ans[li-1]+=ans[i-1]
      dfs(seen,li)
  seen=[0]*n
  dfs(seen,1)
  print(' '.join(list(map(str,ans))))

if __name__=='__main__':
  import sys
  input = sys.stdin.readline
  n,q=map(int,input().split())
  ab=[list(map(int,input().split())) for _ in range(n-1)]
  px=[list(map(int,input().split())) for _ in range(q)]
  main(n,ab,px)
  

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
def main():
    n,q=map(int,input().split())
    graph=[[] for _ in range(n+1)]
    ab=[list(map(int,input().split())) for _ in range(n-1)]
    for a,b in ab:
        graph[a].append(b)
        graph[b].append(a)
    px=[list(map(int,input().split())) for _ in range(q)]
    seen=[0]*(n+1)
    ans=[0]*(n+1)
    for p,x in px:
        ans[p]+=x
    def dfs(i):
        seen[i]=1
        for li in graph[i]:
            if seen[li]==0:
                ans[li]+=ans[i]
                dfs(li)
    dfs(1)
    print(' '.join(map(str,ans[1:])))
if __name__ == '__main__':
    main()
l = map(int,input().split())
print(l[0] * l[1])
print(l[0] * 2 + l[1] * 2)

### FIXED CODE ###

a,b = list(map(int, input().split()))

s = a * b
shu = a * 2 + b * 2
fmt = "{s} {shu}"
s = fmt.format(s = s,shu = shu)
print(s)
from math import asin, atan, pi

a, b, x = map(int, input().split())

if x == a * a * b:
  print(0)
elif x >= a * a * b / 2:
  print(atan((a*a*b-x)/(a*a*a)*2)/(2 * pi)*360)
else:
  print(90 - asin(x/(a*b/2))/(2 * pi)*360)


### FIXED CODE ###

from math import atan, pi

a, b, x = map(int, input().split())

if x == a * a * b:
  print(0)
elif x >= a * a * b / 2:
  print(atan((a*a*b-x)/(a*a*a)*2)/(2 * pi)*360)
else:
  print(90 - atan(x/(a*b*b/2))/(2 * pi)*360)
N = int(input())

coords = [list(map(int, input().split(' '))) for _ in range(N)]

coords.sort(key=lambda x: x[2], reverse=True)

# 全探索
def search():
    for Cx in range(101):
        for Cy in range(101):
            x, y, h = tuple(coords[0])
            H = h + abs(Cx - x) + abs(Cy - y)
            for x, y, h in coords:
                if max(H - abs(Cx - x) - abs(Cy - y), 0) != h:
                    break
            else:
                return (Cx, Cy, H)

print("{} {} {}".format(search()))

### FIXED CODE ###

N = int(input())

coords = [list(map(int, input().split(' '))) for _ in range(N)]

coords.sort(key=lambda x: x[2], reverse=True)

# 全探索
def search():
    for Cx in range(101):
        for Cy in range(101):
            x, y, h = tuple(coords[0])
            H = h + abs(Cx - x) + abs(Cy - y)
            for x, y, h in coords:
                if max(H - abs(Cx - x) - abs(Cy - y), 0) != h:
                    break
            else:
                return Cx, Cy, H

x, y, h = search()
print("{} {} {}".format(x, y, h))
import math

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

limit = math.ceil(math.sqrt(M))
A = []
for i in range(2, limit+1):
  if i in visited:
    continue
  j = i
  while j <= limit:
    visited.add(j)
    j += i
  del j
  k = 0
  while M % i == 0:
    M = M // i
    k += 1
  A.append(k)
if M > 1:
  A.append(1)

  
MOD = 10**9 + 7
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

K = max(A) + N - 1
for i in range(2, K + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

# ②事前計算した項を掛け合わせ
def cmb(n, r, MOD):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % MOD
  
ans = 1  
for a in A:
  ans *= cmb(a + N-1, N-1, MOD)
  ans %= MOD
  
print(ans)
#print(A)
  
  
    
    
    

### FIXED CODE ###

import math
import sys

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

if M == 1:
  print(1)
  sys.exit()
  
limit = math.ceil(math.sqrt(M))
A = []
for i in range(2, limit+1):
  if i in visited:
    continue
  j = i
  while j <= limit:
    visited.add(j)
    j += i
  del j
  k = 0
  while M % i == 0:
    M = M // i
    k += 1
  A.append(k)
if M > 1:
  A.append(1)

  
MOD = 10**9 + 7
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

K = max(A) + N - 1
for i in range(2, K + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

# ②事前計算した項を掛け合わせ
def cmb(n, r, MOD):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % MOD
  
ans = 1  
for a in A:
  ans *= cmb(a + N-1, N-1, MOD)
  ans %= MOD
  
print(ans)
#print(A)
numbers = input().split(" ")
healthOfT = int(numbers[0])
strengthOfT = int(numbers[1])
healthOfA = int(numbers[2])
strengthOfA = int(numbers[3])
for i in(0,1000):
	healthOfA=healthOfA-strengthOfT
	if healthOfA<=0:
		a=i
		break
for p in(0,1000):
	healthOfT=healthOfT-strengthOfA
	if healthOfT<=0:
		break
if p<i:
	print("No")
else:
	print("Yes")

### FIXED CODE ###

s, w = map(int,input().split())
if s <= w:
    print("unsafe")
else:
    print("safe")
X,N=map(int,input().split())
if N==0:
  print(X)
else:
  p=list(map(int,input().split()))
  numbers=list(range(102))
  ans=0

  for i in range(len(p)):
    numbers.remove(p[i])

  if numbers.count(X)==1:
    print(X)
  else:
    for j in range(100):
      if numbers.count(X-j)==1:
        ans=X-j
        break
      elif numbers.count(X+j)==1:
        ans=X+j
        break
  　　print(ans)


### FIXED CODE ###

X,N=map(int,input().split())
if N==0:
  print(X)
else:
  p=list(map(int,input().split()))
  numbers=list(range(102))
  ans=0

  for i in range(len(p)):
    numbers.remove(p[i])

  if numbers.count(X)==1:
    print(X)
  else:
    for j in range(100):
      if numbers.count(X-j)==1:
        ans=X-j
        break
      elif numbers.count(X+j)==1:
        ans=X+j
        break
    print(ans)
import sys

def f(x):
    return x ** 2

def integral(d):
    s = f(d) * d
    for i in range(600 // d - 1):
        s += f(d * (i + 1)) * d
    return s

lines = sys.stdin.readlines()
for line in lines:
    print(integral(line))

### FIXED CODE ###

import sys
 
def f(x):
    return x ** 2
 
def integral(d):
    s = 0
    for i in range(600 // d - 1):
        s += f(d * (i + 1)) * d
    return s
 
lines = sys.stdin.readlines()
for line in lines:
    print(integral(int(line)))
N=int(input())
A=list(map(int,input().split(" ")))
A_p = [ a for a in A if a > 0 ]
A_n = [ -1*a for a in A if a < 0 ]
A_0 = [ a for a in A if a == 0 ]

l_p = len(A_p)
l_n = len(A_n)
l_0 = len(A_0)

if l_p == 0:
    if l_n%2 == 0:
        print(sum(A_n.append(0)))
    if l_0 > 0:
        print(sum(A_n.append(0)))
    else:
        tmp_n=min(A_n)
        A_n.remove(tmp_n)
        print(sum(A_n.append(0))-tmp_n)

elif l_n == 0:
    print(sum(A_p.append(0)))

    

if l_n%2 == 0:
    print(sum(A_p)+sum(A_n))
else:
    if l_0 > 0:
        print(sum(A_p)+sum(A_n))
    else:
        if min(A_n) > min(A_p):
            tmp_n=min(A_p)
            A_p.remove(tmp_n)
            print(sum(A_p.append(0))+sum(A_n)-tmp_n)    
        else:
            tmp_n=min(A_n)
            A_n.remove(tmp_n)
            print(sum(A_p)+sum(A_n.append(0))-tmp_n)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split(" ")))
A_p = [ a for a in A if a > 0 ]
A_n = [ -1*a for a in A if a < 0 ]
A_0 = [ a for a in A if a == 0 ]

l_p = len(A_p)
l_n = len(A_n)
l_0 = len(A_0)

if l_p == 0:
    if l_n%2 == 0:
        print(sum(A_n+[0]))
    elif l_0 > 0:
        print(sum(A_n+[0]))
    else:
        tmp_n=min(A_n)
        A_n.remove(tmp_n)
        print(sum(A_n+[0])-tmp_n)
elif l_n == 0:
    print(sum(A_p+[0]))

elif l_n%2 == 0:
    print(sum(A_p)+sum(A_n))
else:
    if l_0 > 0:
        print(sum(A_p)+sum(A_n))
    else:
        if min(A_n) > min(A_p):
            tmp_n=min(A_p)
            A_p.remove(tmp_n)
            print(sum(A_p)+sum(A_n)-tmp_n)    
        else:
            tmp_n=min(A_n)
            A_n.remove(tmp_n)
            print(sum(A_p)+sum(A_n)-tmp_n)
n = str(input())
if len(n) % 2 ==1:
  print('No')
else:
  a = n[0 : len(n)/2]
  b = n[len(n)/2 : len(n)]
  if a == b:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

nn = input()
n = str(input())

if len(n) % 2 == 1:
  print('No')
else:
  a = n[0 : len(n)//2]
  b = n[len(n)//2 : len(n)]
  if a == b:
    print('Yes')
  else:
    print('No')
import sys
from collections import deque

S=raw_input()
Q=input()
Query=[ sys.stdin.readline().split() for _ in range(Q) ]

s1=deque()
s2=deque()
judge={}
judge["front"]="s1"
judge["end"]="s2"

cnt=0
for x in Query:
    if x[0]=="1":
        n=x[0]
        cnt+=1
    elif x[0]=="2":
        n,f,c=x[0],x[1],x[2]
    if n=="1":
        judge["front"],judge["end"]=judge["end"],judge["front"]
    elif n=="2":
        if f=="1":
            if judge["front"]=="s1":
                s1.appendleft(c)
            elif judge["front"]=="s2":
                s2.appendleft(c)
        elif f=="2":
            if judge["end"]=="s1":
                s1.append(c)
            if judge["end"]=="s2":
                s2.append(c)

str1=""
for x in s1:
    str1+=x
str2=""
for x in s2:
    str2+=x

if cnt%2==0:
    print str1[::-1]+S+str2
elif cnt%2==1:
    print str2+S[::-1]+str1[::-1]


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import defaultdict

N,P=map(int, sys.stdin.readline().split())
S=sys.stdin.readline().strip()
S=S[::-1]

ans=0
if P in (2,5):
    len_S=len(S)
    for i,x in enumerate(S):
        x=int(x)
        if x%P==0:
            ans+=(len_S-i)
    print ans
else:
    L=[0] 
    val=0
    for i,x in enumerate(S):
        x=int(x)
        val+=pow(10,i,P)*x
        L.append(val%P)

    C=defaultdict(lambda: 0)    #mod2019の値の出現個数を記録
    for x in L:
        ans+=C[x]   #自分とmod2019の結果が同じ値となる出現個数をansに足す
        C[x]+=1     #自分のmod2019の値を出現個数に+1カウント
    print ans
# -*- coding:utf-8 -*-

def main():
    for i in range(int(input())):
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())
        a=(y2-y1)/(x2-x1)
        b=(y4-y3)/(x4-x3)

        if abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10:
            print("YES")
        else:
            print("NO")
    
        
if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding:utf-8 -*-

def main():
    for i in range(int(input())):
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())

        if abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10:
            print("YES")
        else:
            print("NO")
    
        
if __name__ == '__main__':
    main()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
a = factorization(n)
ans = 1
if len(a) == 1 and a[0]!=n:
  ans += a[1]-1
b = factorization(n-1)
chk = 1
for i in range(len(b)):
  chk *= (b[i][1]+1)
ans += chk-1
print(a)
if len(a) >= 2:
  for i in range(len(a)):
    for j in range(a[i][1]+1):
      if j!=0 and int(n/(a[i][0]**(j)))%(a[i][0]**(j)) == 1:
        ans += 1
print(ans)

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
  
def divisorize(n):
    ## 約数
    f = factorization(n)
    divisors = [1]
    for k in range(len(f)):
        num_divisors = len(divisors)
        for i in range(1, f[k][1] + 1):
            for j in range(num_divisors):
                divisors.append(divisors[j] * f[k][0] ** i)
    return sorted(divisors)
  
n = int(input())
ans = 0
chk = divisorize(n-1)
for i in divisorize(n)[1:]:
  m = n
  while True:
    if m == 1:
        ans += 1
        chk.append(i)
        break
    if m < i:
      break
    if m%i == 0:
      m = m//i
    else:
      m = m%i

chk = set(chk)
print(len(chk)-1)
x = int(input)
print(x**3)

### FIXED CODE ###

print(int(input())**3)
import math
N,K=map(int, input().split())
h = list(map(int, input().split())) 

dp = [float('inf')] * N
dp[0] = 0

for i in range(N-K):
    for j in range(1,K+1):
        if (i+j < N):
            dp[i+j]=min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))

print(dp[N-1])

### FIXED CODE ###

import math
N = int(input())
h = list(map(int, input().split())) 

dp = [0] * N
dp[0] = 0
dp[1] = abs(h[1]-h[0])
 
for i in range(2,N):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])
import sys
input = sys.stdin.readline
N = int(input())


node = [0 for i in range(N)]
neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1] += 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)
flag = False
def dfs(neighbor,start):
    global flag
    global k
    if sum(visited) == N:
        return 0

    for i in neighbor[start]:
        
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            try:
                dfs(neighbor,i)
            except ValueError:
                flag = True
                return 0




m = max(node)
nn = node.index(m)
#nn = [node[i] for i in range(N) if node[i] == m][0]
visited[nn] = 1
ans[nn] = max(c)
"""
if N == 9999:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
"""
dfs(neigh,nn)
if flag:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
ans2 = ' '.join([str(ans[i]) for i in range(N)])


print(sum(c)-max(c))
print(ans2)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(input())


node = [0 for i in range(N)]
neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1] += 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)
flag = False
def dfs(neighbor,start):
    global flag
    global k
    if sum(visited) == N:
        return 0

    for i in neighbor[start]:
        
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            try:
                dfs(neighbor,i)
            except RuntimeError:
                flag = True
                return 0




m = max(node)
nn = node.index(m)
#nn = [node[i] for i in range(N) if node[i] == m][0]
visited[nn] = 1
ans[nn] = max(c)

dfs(neigh,nn)
"""
if flag:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
"""
ans2 = ' '.join([str(ans[i]) for i in range(N)])


print(sum(c)-max(c))
print(ans2)
n,k = map(int,input().split())
a = list(map(int,input().split()))
e = [0]*n
b = [0]*n-(k-1)
for i in range(n):
  e[i] = (1+a[i])/2

b[0] = sum(e[0:k])
for i in range(1, len(b)):
  b[i] = e[i] + b[i-1] - e[i-1]
print(max(b))

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
e = [0]*n
b = [0]*(n-(k-1))
for i in range(n):
  e[i] = (1+a[i])/2

b[0] = sum(e[0:k])
for i in range(1, len(b)):
  b[i] = e[i+k-1] + b[i-1] - e[i-1]
print(max(b))
n,m,k=[int(x) for x in input().split()]
#TODO Mutiply wih m
if m==1:
  if k==n-1: print(1)
  else: print(0)
  exit()
sumi=0
mod=998244353
prodi=pow(m-1,n-1,mod)
invi=pow(m-1,mod-2,mod)
for j in range(n-1,n-1-k-1,-1):
  sumi+=prodi
  sumi%=mod
  prodi*=j
  prodi%=mod
  prodi*=pow(n-j,mod-2,mod)
  prodi%=mod
  prodi*=invi
  prodi%=mod 
sumi*=m
sumi%=mod
print(sumi)
  

### FIXED CODE ###

s=input()
t=input()
if s==t[0:len(t)-1]: print("Yes")
else: print("No")
n = int(input())
a = ord('a')

def f(x: int) -> str:
  return chr(x + a)

for i in range(2 * 10 ** (n-2)):
  x = list(map(int, str(i).zfill(n)))
  maximum = 0
  flag = True
  for j, digit in enumerate(x):
    if digit > maximum + 1:
      flag = False
      break
    elif digit == maximum + 1:
      maximum = digit
  if flag:
    print(''.join(map(f, x)))
  else:
    d = 10 ** (n - j)
    i = (i // d + 1) * d

### FIXED CODE ###

n = int(input())
a = ord('a')

def f(x: str) -> str:
  return chr(int(x) + a)

i = 0
while i < 10 ** (n-1):
  x = str(i).zfill(n)
  maximum = 0
  flag = True
  for j, digit in enumerate(map(int, x)):
    if digit > maximum + 1:
      flag = False
      break
    elif digit == maximum + 1:
      maximum = digit
  if flag:
    print(''.join(map(f, x)))
    i += 1
  else:
    d = 10 ** (n - j)
    i = (i // d + 1) * d
N = int(input())
A = list(map(int, input().split()))
res = 1

if 0 in A :
    res = 0

for x in range(N) :
    res = res*A[x]
    if res > 10**18
        res = -1
        break

print(res)


### FIXED CODE ###

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

limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
    result *= a
    if result > limit:
        print(-1)
        exit()
print(result)
import sys
input = sys.stdin.buffer.readline

def main():
    N,M = map(int,input().split())
    
    edge = [[] for _ in range(N)]
    for _ in range(M):
        x,y = map(int,input().split())
        edge[x-1].append(y-1)
        
    dist = [-1 for _ in range(N)]
            
    def dfs(s):
        if dist[s] != -1:
            return dist[s]
        else:
            ret = 0
            for fol in edge[s]:
                ret = max(ret,dfs(fol)+1)
            dist[s] = ret
            return ret
    
    ans = 0    
    for i in range(N):
        ans = max(ans,dfs(i))
        
    print(ans)
        
if __name__ == "__main__":
    main()


### FIXED CODE ###

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

def main():
    N,M = map(int,input().split())
    
    edge = [[] for _ in range(N)]
    for _ in range(M):
        x,y = map(int,input().split())
        edge[x-1].append(y-1)
        
    dist = [-1 for _ in range(N)]
            
    def dfs(s):
        if dist[s] != -1:
            return dist[s]
        else:
            ret = 0
            for fol in edge[s]:
                ret = max(ret,dfs(fol)+1)
            dist[s] = ret
            return ret

    for i in range(N):
        dfs(i)
        
    print(max(dist))
    
if __name__ == "__main__":
    main()
import sys
readline = sys.stdin.readline


def check(x):
    if x - 50*A >= 100:
        return N+1
    right = x//A
    left = 1
    while abs(right - left) > 2:
        med1 = (left*2+right)//3
        med2 = (left+right*2)//3
        if calc(med1, x-(med1-1)*A) < calc(med2, x-(med2-1)*A):
            left = med1
        else:
            right = med2
    
    res = 0
    for l in range(left, right+1):
        cl = calc(l, x-(l-1)*A)
        if res < cl:
            res = cl
    return res
    
    
def calc(k, c):
    return pow(c//k+1, c%k)*pow(c//k, k-c%k)

N, A = map(int, readline().split())

ok = N
ng = 0
while abs(ok-ng)>1:
    med = (ok+ng)//2
    if check(med) >= N:
        ok = med
    else:
        ng = med
print(ok)
    
    

### FIXED CODE ###

import sys
readline = sys.stdin.readline

def check(x):
    if x - 50*A >= 100:
        return N+1
    right = (x+A)//(1+A)
    left = 1
    res = 0
    for l in range(left, right+1):
        cl = calc(l, x-(l-1)*A)
        if res < cl:
            res = cl
    return res
    
    
def calc(k, c):
    return pow(c//k+1, c%k)*pow(c//k, k-c%k)

N, A = map(int, readline().split())


ok = N
ng = 0
while abs(ok-ng)>1:
    med = (ok+ng)//2
    if check(med) >= N:
        ok = med
    else:
        ng = med
    
print(ok)