Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * (1100000)
def find(x):
    if root[x] >= 0:
        root[x] = find(x)
        return root[x]
    else:
        return x

def unite(a, b):
    a = find(a)
    b = find(b)
    if a != b:
        root[a] += root[b]
        root[b] = a
        

for _ in range(m):
    a, b = map(int, input().split())
    unite(a, b)

ans = 0
for i in range(1, n+1):
    if root[i]  < 0:
        ans += 1
print(ans-1)
print(root)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n
def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]
    

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
        

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)

ans = len([i for i in root if i < 0]) - 1
print(ans)
a, b = map(int, input().split())

if (a > b and b != 1) or (a==1 and b!=1):
    print('Alice')
elif (b > a a!=1) and (a!=1 and b==1):
    print('Bob')
else:
    print('Draw')



### FIXED CODE ###

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

if (a > b and b != 1) or (a==1 and b!=1):
    print('Alice')
elif (b > a and a!=1) or (a!=1 and b==1):
    print('Bob')
else:
    print('Draw')
def ABC076C_DubiousDocument2():
    Sd = list(input().strip())
    T = list(input().strip())

    tlen = len(T)
    slen = len(Sd)

    ans = 'UNRESTORABLE'
    nowPos = 0
    for pos in range(slen - 1, -1, -1):
        if pos < (tlen - 1):
            break
        if(T[tlen - (slen - 1 - pos) - 1] == Sd[pos]) or (Sd[pos] == '?'):
            nowPos = pos
            match = True
            for chk in range(nowPos, nowPos - tlen, -1):
                if(T[tlen - (nowPos - chk) - 1] != Sd[chk]) and (Sd[chk] != '?'):
                    match = False
                    break

            if match:
                # 書き換え
                for chk in range(nowPos, nowPos - tlen, -1):
                    Sd[chk] = T[tlen - (nowPos - chk) - 1]
                for i in range(0, slen):
                    if Sd[i] == '?':
                        Sd[i] = 'a'
                # 答えはこれ
                ans = ''.join(Sd)

    print(ans)

def main():
    ABC076C_DubiousDocument2()

if __name__ == "__main__":
    main()


### FIXED CODE ###

def ABC076C_DubiousDocument2():
    Sd = list(input().strip())
    T = list(input().strip())

    tlen = len(T)
    slen = len(Sd)

    ans = 'UNRESTORABLE'
    nowPos = 0
    for pos in range(slen - 1, -1, -1):
        if pos < (tlen - 1):
            break
        if(T[tlen - 1] == Sd[pos]) or (Sd[pos] == '?'):
            nowPos = pos
            match = True
            for chk in range(nowPos, nowPos - tlen, -1):
                if(T[tlen - (nowPos - chk) - 1] != Sd[chk]) and (Sd[chk] != '?'):
                    match = False
                    break

            if match:
                # 書き換え
                for chk in range(nowPos, nowPos - tlen, -1):
                    Sd[chk] = T[tlen - (nowPos - chk) - 1]
                for i in range(0, slen):
                    if Sd[i] == '?':
                        Sd[i] = 'a'
                # 答えはこれ
                ans = ''.join(Sd)

    print(ans)

def main():
    ABC076C_DubiousDocument2()

if __name__ == "__main__":
    main()
import sys
import math
import collections
from collections import deque
#n = int(input())
#a, b = map(int, input().split())
s = input()
#x = list(map(int, input().split()))
q = int(input())
d = deque([])
for i in range(len(s)):
    d.append(s[i])

rev = 1
for i in range(q):
    que = list(map(int, input().split()))
    if que[0] == "1":
        rev *= -1

    else:
        if rev == 1:
            if que[1] == "1":
                d.appendleft(que[2])
            else:
                d.append(que[2])

        else:
            if que[1] == "1":
                d.append(que[2])
            else:
                d.appendleft(que[2])


if rev == 1:
    for i in range(len(d)):
        print(d.popleft(), end="")
else:
    for i in range(len(d)):
        print(d.pop(), end="")




### FIXED CODE ###

import sys
import math
import collections
from collections import deque
def main():
    #n = int(input())
    #a, b = map(int, input().split())
    s = input()
    #x = list(map(int, input().split()))
    q = int(input())
    d = deque([])
    for i in range(len(s)):
        d.append(s[i])

    rev = 1
    for i in range(q):
        que = sys.stdin.readline().split()
        if que[0] == "1":
            rev *= -1

        else:
            if rev == 1:
                if que[1] == "1":
                    d.appendleft(que[2])
                else:
                    d.append(que[2])

            else:
                if que[1] == "1":
                    d.append(que[2])
                else:
                    d.appendleft(que[2])


    if rev == 1:
        for i in range(len(d)):
            print(d.popleft(), end="")
    else:
        for i in range(len(d)):
            print(d.pop(), end="")

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

if n==1:
    print(0)
    sys.exit()

def abs(a):
    if a<0:
        return -a
    else:
        return a

for i in range(n):
    a[i]=a[i]-i-1

ans=10**12
a.sort()
if n<20:
    for b in a:
        S=0
        for j in range(n):
            S+=abs(a[j]-b)
        ans=min(ans,S)
    if ans==10**12:
        ans=0
    print(ans)
    sys.exit()

mid=n//2
if a[mid]<0:
    b_choice=a[mid-20:mid]
else:
    b_choice=a[mid:mid+20]
for b in b_choice:
    S=0
    for j in range(n):
        S+=abs(a[j]-b)
    ans=min(ans,S)
if ans==10**12:
    ans=0
print(ans)

### FIXED CODE ###

n=int(input())

if n%2==0:
    print(n)
else:
    print(2*n)
def dfs(kazu,i,j,ans):
    global result
    if ans>k:
        result.append(kazu-1)
        return
    elif i==n and j==m:
        result.append(kazu)
        return
    elif i==n:
        #bの本を読む
        dfs(kazu+1,i,j+1,ans+b[j])
    elif j==m:
        #aの本を読む
        dfs(kazu+1,i+1,j,ans+a[i])
    else:
        #aの本を読む
        dfs(kazu+1,i+1,j,ans+a[i])
        #bの本を読む
        dfs(kazu+1,i,j+1,ans+b[j])

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

result = []

dfs(0,0,0,0)

print(max(result))

### FIXED CODE ###

n,m,k = map(int,input().split())
tmp_a = list(map(int,input().split()))
tmp_b = list(map(int,input().split()))
a = [0]
b = [0]
for i in range(n):
    a.append(a[i]+tmp_a[i])
for i in range(m):
    b.append(b[i]+tmp_b[i])
#print(a)
#print(b)
ans = 0
j = m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans,i+j)
print(ans)
S = input()
keyence_len = len("keyence")
keyence="keyence"

now=0
remove=False
removeout=False
for i in range(len(S)):
    if S[i]==keyence[now]:
        if remove:
            removeout = True
        now+=1
    else:
        if removeout:
            print("NO")
            exit()
        remove=True
if now==keyence_len:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

S = input()
N = len(S)
keyence="keyence"

for i in range(N-1):
    for j in range(i,N):
        try_str = S[:i] + S[j:]
        if try_str == keyence:
            print("YES")
            exit()
print("NO")
W,H,x,y=map(int,input().split())
if x==W/2 and y==H/2:
  print(float(W*H/2),1)
elif x==W/2 and (not y==H/2):
  print(float(W*H/2),0)
elif (not x==W/2) and y==H/2:
  print(float(W*H/2),0)
else:
  if H/W==y/x or W/H==-(y/x):
    print(float(W*H/2),0)
  else:
    print(float(W*H/2),0)
    
 


### FIXED CODE ###

W,H,x,y=map(int,input().split())
if x==W/2 and y==H/2:
  print(float(W*H/2),1)
else:
  print(float(W*H/2),0)
def add(tree,i, num):
    tree[i-1][0] += num
    for j in range(1,len(tree[i-1])):  
        add(tree, tree[i-1][j], num)

n, q = map(int, input().split())
tree = [[] * (n) for i in range(n)]
tree[0].append(0)
for i in range(n-1):
    a, b = map(int, input().split())
    tree[b-1].append(0)
    tree[a-1].append(b)

for i in range(q):
    a, b = map(int, input().split())
    add(tree, a, b)

for i in range(n):
    print(tree[i][0], end=" ")


### FIXED CODE ###


# n, q = map(int, input().split())

# edge = [[] for _ in range(n)]

# counter = [0] * n

# for _ in range(n-1):
#     a, b = map(int, input().split())
#     edge[a-1].append(b-1)
#     edge[b-1].append(a-1)

# for _ in range(q):
#     a, b = map(int, input().split())
#     counter[a-1] += b

# parent = [0]
# visited = []

# for i in parent:
#     visited.append(i)
#     for v in edge[i]:
#         if v in visited:
#             continue
#         parent.append(v)
#         counter[v] += counter[i]
        
# for i in range(n):
#     print(counter[i], end=" ")
# print("")

import sys
input = sys.stdin.readline
 
N, Q = [int(x) for x in input().split()]
 
edge = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = [int(x) for x in input().split()]
    edge[a - 1].append(b - 1)
    edge[b - 1].append(a - 1)
 
cost = [0] * N
for _ in range(Q):
    p, x = [int(x) for x in input().split()]
    cost[p - 1] += x
 
next = [0]
s_next = {0}
for i in next:
    for v in edge[i]:
        if v in s_next:
            continue
        s_next.add(v)
        next.append(v)
        cost[v] += cost[i]
 
print(" ".join(map(str, cost)))
N = int(input())
L = [[int(l) for l in input().split()] for _ in range(N)]

d = 0
for i in range(N-1):
    for j in range(i+1, N):
        tempd = ((L[i][0]-L[j][0])**2+(L[i][1]-L[j][1])**2)**0.5
        if d < tempd:
            d = tempd
            p = (i, j)

c = [(L[p[0]][0]+L[p[1]][0])/2, (L[p[0]][1]+L[p[1]][1])/2]
dc = 0
for i in range(N):
    if i == p[0] or i == p[1]:
        continue
    tempd = ((c[0]-L[i][0])**2+(c[1]-L[i][1])**2)**0.5
    if dc < tempd:
        dc = tempd
        pc = i

if dc <= d/2:
    ans = d/2
else:
    i = p[0]
    j = p[1]
    k = pc

    a = L[i][0]
    b = L[i][1]
    c = L[j][0]
    d = L[j][1]
    e = L[k][0]
    f = L[k][1]

    aa = a * a
    bb = b * b
    cc = c * c
    dd = d * d
    ee = e * e
    ff = f * f
    py = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)) / (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f))

    px = (2 * (b - f) * py - aa - bb + ee + ff) / (2 * (e - a)) \
        if (c == a) else (2 * (b - d) * py - aa - bb + cc + dd) / (2 * (c - a))

    ans = math.hypot(px - a, py - b)

print(ans)


### FIXED CODE ###

N = int(input())
L = [[int(l) for l in input().split()] for _ in range(N)]

def dist(x, y, x0, y0):
    return ((x-x0)**2 + (y-y0)**2)**0.5

def f(x, y):
    res = 0
    for i in range(N):
        res = max(res, dist(L[i][0], L[i][1], x, y))
    return res

lx = -10**4
rx = 10**4
for _ in range(100):
    cx1 = (lx*2 + rx) / 3
    ly = -10**4
    ry = 10**4
    for _ in range(100):
        cy1 = (ly*2 + ry) / 3
        cy2 = (ly + ry*2) / 3
        if f(cx1, cy1) < f(cx1, cy2):
            ry = cy2
        else:
            ly = cy1
    y = (ly + ry) / 2
    
    cx2 = (lx + rx*2) / 3
    ly = -10**4
    ry = 10**4
    for _ in range(100):
        cy1 = (ly*2 + ry) / 3
        cy2 = (ly + ry*2) / 3
        if f(cx2, cy1) < f(cx2, cy2):
            ry = cy2
        else:
            ly = cy1

    if f(cx1, y) < f(cx2, ly):
        rx = cx2
        ans = f(cx1, y)
    else:
        lx = cx1
        ans = f(cx2, ly)

print(ans)
import os
import io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline


n, q = list(map(int, input().split()))
count = (n - 2) ** 2
c = [n] * n
r = [n] * n
mc = n
mr = n
for _ in range(q):
  m,q = list(map(int, input().split()))
  if m == 1:
    pos = r[q-1]
    if q < mc:
        mc = q
        for p in range(pos):
            c[p] = q
    if q not in [1,n]:
      count -= max(0, pos - 2)
  else:
    pos = c[q-1]
    if q < mr:
        mr = q
        for p in range(pos):
            r[p] = q
    if q not in [1,n]:
      count -= max(0, pos-2)
print(count)



### FIXED CODE ###

word = input()

if word[-1] == 's':
  print(word+'es')
else:
  print(word+'s')
n,k=map(int,input().split())
h=[int(input()) for i in range(n)]
h.sort()
ans=10**18
for i in range(k,n+1):
  ans=min(h[i-1]-h[i-k])
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
h=[int(input()) for i in range(n)]
h.sort()
ans=10**18
for i in range(k,n+1):
  ans=min(ans,h[i-1]-h[i-k])
print(ans)
n = "".join(map(int,input().split()))
print(sum(n))

### FIXED CODE ###

n = input()
ans = 0
for i in range(len(n)):
    ans += int(n[i])
print(ans)
N,M,X = map(int, input().split())
grid = [[]]
for i in range(N):
    ls = list(map(int, input().split()))
    grid.append(ls)

def rec(r,progress,result):
    if r == N:
        progress = progress 
        result.append(progress)
        progress = progress + [grid[N]]
        result.append(progress)
        return
    else:
        rec(r+1,progress,result)
        progress = progress + [grid[r]]
        rec(r+1,progress,result)

def rap():
    result = []
    progress = []
    rec(0,progress,result)
    ans = float('inf')
    for item in result:
        stals = [0]*(M+1)
        for item2 in item:
            for i, j in enumerate(item2):
                stals[i] += j
        f = True
        for  m in stals[1:]:
            if m < X:
                f = False
        if f:
            ans = min(ans,stals[0])
            
    if  ans == float('inf'):
        print(-1)
    else:
        print(ans)
            
    return 
    
rap()

### FIXED CODE ###

S = str(input())
T = str(input())

T = T[:(len(T)-1)]
if S == T:
    print('Yes')
else:
    print('No')
from scipy.sparse import lil_matrix
from scipy.sparse.csgraph import shortest_path
n, m = map(int, input().split())
graph = lil_matrix((n+1,n+1), dtype=int)
for i in range(m):
    u, v = map(int, input().split())
    graph[u, v] = 1
start, goal = map(int, input().split())
graph = graph * graph * graph
k = shortest_path(graph, indices=start)
if k[goal] != float('inf'):
    print(int(k[goal]))
else:
    print(-1)

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
inf = 10**9
def bfs(start):
    dist = [inf for i in range((n+1) * 3)]
    que = deque()
    que.append(start)
    finished = set()
    dist[start] = 0
    while que:
        node = que.popleft()
        if node not in finished:
            finished.add(node)
            for i in adjacent_list[node]:
                dist[i] = min(dist[i], dist[node] + 1)
                que.append(i)
    return dist

adjacent_list = [[] for i in range((n+1)*3)]
for _ in range(m):
    u, v = map(int, input().split())
    for i in range(3):
        adjacent_list[u*3 + i].append(v*3 +((i+1)%3))
start, goal = map(int, input().split())
graph = bfs(start*3)
if graph[goal*3] != inf:
    print(int(graph[goal*3]) // 3)
else:
    print(-1)
def whatIsMinNumber(X_copy,K):
    pickupNum = X_copy[len(X_copy)//2]
    X_rest = X[:]
    X_rest.remove(pickupNum)
    if can_do_number(X_rest,pickupNum,K,K+pickupNum-1):
        if len(X_copy) > 2:
            return whatIsMinNumber(X_copy[len(X_copy)//2+1:len(X_copy)],K)
        else:
            return pickupNum
    else:
        if len(X_copy) > 1:
            return whatIsMinNumber(X_copy[0:len(X_copy)//2],K)
        else:
            return pickupNum+1

def can_do_number(X,sum,min,max):
    #残りのカードがない場合はFalseを返す
    if len(X) == 0:
        return False
    #残りのカードで順番に調べる
    for i in range(0,len(X)):
        if min <= sum+X[i] <= max:
            return True
        elif min > sum+X[i]:
            X_rest = X[:]
            sum = sum + X_rest.pop(i)
            can_do_number(X_rest,sum,min,max)
        else:
            pass
    return False

N,K = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort(reverse = True)
thenum = whatIsMinNumber(X[:],K)
print(len(list(filter((lambda x:x<thenum),X))))

### FIXED CODE ###

a,b = input().split()
if a == b:
     print('H')
else:
     print('D')
c = input()

vowel = ['a', 'i', 'u', 'e', 'o']
if c in boin:
    print('vowel')
else:
    print('consonant')

### FIXED CODE ###

c = input()

vowel = ['a', 'i', 'u', 'e', 'o']
if c in vowel:
    print('vowel')
else:
    print('consonant')
n,a,b = map(int,input().split())
print(min[a*n,b])

### FIXED CODE ###

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

def comb_count(n, r):
    return math.factorial(n) / math.factorial(r) / math.factorial(n - r)

S = input()[::-1]
ans = 0

mods = [0] * 2019 #余りが0~2018
mods[0] = 1
current = 0
tmp = 1

for i in range(len(S)):
    current = int(S[i]) * tmp + current
    mod = current % 2019
    mods[mod] += 1
    tmp = tmp * 10

for mod in mods:
    if mod > 1:
        ans += comb_count(mod, 2)
print(int(ans))



### FIXED CODE ###

import math

# def comb_count(n, r):
#     return math.factorial(n) // math.factorial(r) // math.factorial(n - r)

S = input()[::-1]
ans = 0

mods = [0] * 2019 #余りが0~2018
mods[0] = 1
current = 0
tmp = 1

for i in range(len(S)):
    current = (int(S[i]) * tmp + current) % 2019
    mod = current % 2019
    ans += mods[mod]
    mods[mod] += 1
    tmp = tmp * 10 % 2019

# for mod in mods:
#     if mod > 1:
#         ans += comb_count(mod, 2)
print(ans)
n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n+1):
    distance += l[i]
    if distance<=x:
        _count += 1
print(_count)

### FIXED CODE ###

n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n):
    distance += l[i]
    if distance<=x:
        _count += 1
    else:
        break
print(_count)
n, k = map(int, input().split())
pos = [int(i) for i in input().split()]
score = [int(i) for i in input().split()]
if max(score) <= 0:
  print(max(score))
else:
  pos = [0] + pos
  score = [0] + score
  max_point = -10 ** 10
  s_l = [[0]]
  nei = {}
  dic = {}
  loop = 0
  for i in range(1, n + 1):
    f_pos = i
    #print('f_pos',f_pos)
    points = [0]
    count = 0
    if f_pos not in nei:
      loop += 1
      while True:
        n_pos = pos[f_pos]
        points.append(points[-1] + score[n_pos])
        count += 1
        nei[f_pos] = [count, loop]
        if n_pos in nei:
          dic[loop] = count
          break
        f_pos = n_pos
      #print(points)
      #print(nei)
      s_l.append(points)
      loop_num = count
      count = 1
    else:
      loop = nei[f_pos][1]
      count = nei[f_pos][0]
      loop_num = dic[loop]
      points = s_l[loop]
    s = points[count - 1]
    m = points[loop_num] - s
    a = k // loop_num
    b = k % loop_num
    if points[loop_num] > 0:
      point = points[loop_num] * a
      if b > 0:
        if loop_num - count + 1 >= b:
          t_max = -10 ** 10
          for j in range(b):
            t = points[j + count] - s
            if t > t_max:
              t_max = t
        else:
          t_max = -10 ** 10
          for j in range(count, loop_num + 1):
            t = points[j] - s
            if t > t_max:
              t_max = t
          for j in range(1, b - loop_num + count):
            t = points[j] + m
            if t > t_max:
              t_max = t
        point += t_max
    else:
      point = max(points)
    #print(point)
    if point > max_point:
      max_point = point
  print(max_point)

### FIXED CODE ###

n, k = map(int, input().split())
positions = [int(i) for i in input().split()]
scores = [int(i) for i in input().split()]
if max(scores) <= 0:
  print(max(scores))
else:
  positions = [0] + positions
  scores = [0] + scores
  max_point = -pow(10, 9)
  #print(max_point)
  for i in range(1, n + 1):
    s = []
    f_pos = positions[i]
    score = scores[f_pos]
    s.append(score)
    while f_pos != i:
      f_pos = positions[f_pos]
      score += scores[f_pos]
      s.append(score)
    loop = len(s)
    if loop >= k:
      point = max(s[:k])
    elif s[-1] <= 0:
      point = max(s)
    else:
      loop_c = k // loop
      r = k % loop
      point1 = s[-1] * loop_c
      if r != 0:
        point1 += max(s[:r])
      point2 = s[-1] * (loop_c - 1)
      point2 += max(0, max(s))
      point = max(point1, point2)
    max_point = max(max_point, point)
  print(max_point)
import sys
sys.setrecursionlimit(10 ** 6)  # 変更
from bisect import bisect_left,bisect

n = int(input())
x = list(map(int,input().split()))
L = int(input())
t = n.bit_length()
prv = [n-1] * n
for i in range(n):
    prv[i] = bisect(x,x[i]+L) - 1
kprv = [prv]
S = prv
for i in range(t-1):
    kar = [n-1] * n
    for j in range(n):
        kar[j] = S[S[j]]
    kprv.append(kar)
    S = kar

dub = []
for i in range(n):
    kar = []
    for j in range(len(kprv)):
        kar.append(kprv[j][i])
    dub.append(kar)

q = int(input())
for _ in range(q):
    a , b = map(lambda x:int(x)-1,input().split())
    if a > b:
        a , b = b , a
    now = a
    ans = 0
    while True:
        p = bisect_left(dub[now],b)
        if dub[now][p] == b:
            ans += pow(2,p)
            print(ans)
            break
        else:
            ans += pow(2,p-1)
            now = dub[now][p-1]
            

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)  # 変更
from bisect import bisect_left,bisect

n = int(input())
x = list(map(int,input().split()))
L = int(input())
t = n.bit_length()
prv = [n-1] * n
for i in range(n):
    prv[i] = bisect(x,x[i]+L) - 1
kprv = [prv]
S = prv
for i in range(t-1):
    kar = [n-1] * n
    for j in range(n):
        kar[j] = S[S[j]]
    kprv.append(kar)
    S = kar

q = int(input())
for _ in range(q):
    a , b = map(lambda x:int(x)-1,input().split())
    if a > b:
        a , b = b , a
    lef = 0
    rig = n-1
    while rig - lef > 1:
        mid = (rig+lef)//2
        p = mid.bit_length()
        now = a
        for i in range(p):
            if (mid>>i) & 1 == 1:
                now = kprv[i][now]
        if now >= b:
            rig = mid
        elif now < b:
            lef = mid
    print(rig)
while True:
    H, W =[int(i) for i in input().split ]
    if H == W == 0:
       break

    for h in range(H):
        for w in range(W):
            if h == 0 or h == H -1 or w == 0 or w == W - 1:
               print('#', end='')
            else:
                print('*', end='')

        print()

    print()

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break
     
    for h in range(H):
        for w in range(W):
            if h == 0 or h == H-1 or w == 0 or w == W - 1:
                print('#', end='')
            else:
                print('.', end='')
        print()
     
    print()
print(sum(list(input())))

### FIXED CODE ###

print(sum(map(int,list(input()))))
import math
def is_sosu(n):
  for i in range(2, math.sqrt(n)//1+1):
    if n % i == 0:
      return False
  return True

x = int(input())
for i in range(x, x*2):
  if is_sosu(i):
    print(i)
    exit()

### FIXED CODE ###

import math
def is_sosu(n):
  for i in range(2, math.floor(math.sqrt(n))+1):
    if n % i == 0:
      return False
  return True

x = int(input())
for i in range(x, x*2):
  if is_sosu(i):
    print(i)
    exit()
l = int(input())

arr = []
for a in range(1,l):
    for b in range(1,l):
        c = l - a - b
        if a + b + c == l:
            arr.append(a*b*c)

print(max(arr))
            


### FIXED CODE ###

l = int(input())
       
print((l/3) ** 3)