YN = ['No', 'Yes']
S = input()
T = input()
print(YN[T in S])
import sys
from collections import Counter
def i2s(): return sys.stdin.readline().rstrip()
def i2nn(): return list(map(int, i2s().split()))
YN=['No','Yes']
H,W=i2nn()
S=[i2s() for _ in range(H)]
T=[i2s() for _ in range(H)]
print(YN[
Counter(tuple(S[r][c] for r in range(H)) for c in range(W)) ==
Counter(tuple(T[r][c] for r in range(H)) for c in range(W))
])
import sys
def i2s(): return sys.stdin.readline().rstrip()
def i2nn(): return list(map(int, i2s().split()))
A,B=i2nn()
def f(x): return A * (1+x)**-0.5 + B*x
def fd(x): return -0.5 * A * (1+x)**(-1.5) + B
def main():
def is_ok(x) -> bool:
return fd(x) <= 0
ok = 0
ng = -(-A//B)
while ng - ok > 1:
mid = (ok + ng) // 2
if is_ok(mid):
ok = mid
else:
ng = mid
print(min(f(ok), f(ng)))
return
main()
import sys
import math
def i2s(): return sys.stdin.readline().rstrip()
def i2nn(): return list(map(int, i2s().split()))
A,B=i2nn()
def f(x): return A * (1+x)**-0.5 + B*x
def g(A,B): return (A/(2*B))**(2/3) - 1
x = max(0, math.floor(g(A, B)))
print(min(f(x), f(x+1)))
import sys
def i2s(): return sys.stdin.readline().rstrip()
def i2nn(): return list(map(int, i2s().split()))
N,M=i2nn()
A=i2nn()
B = list(range(N+1))
for a in A:
B[a], B[a+1] = B[a+1], B[a]
inv = {b: i for i, b in enumerate(B)}
ans = []
for a in reversed(A):
x, y = B[a], B[a+1] = B[a+1], B[a]
inv[x], inv[y] = inv[y], inv[x]
ans.append(inv[1])
inv[x], inv[y] = inv[y], inv[x]
print(*reversed(ans), sep='\n')
root[i]
には 箱i を示すルートノードが格納されていますparent[j]
には ボールj の親ノードが格納されていますroot[Y]
を親ノードをroot[X]
とします
root[Y]
は親ノードを持つのでルートノードではなくなりますroot[Y]
に新たなルートノード[Y]
を代入し、元ルートノードへの直接的な参照はできなくなりますparent[j]
に root[X]
を追加しますimport sys
sys.setrecursionlimit(2**31-1)
def i2s(): return sys.stdin.readline().rstrip()
def i2nn(): return list(map(int, i2s().split()))
N,Q=i2nn()
root = [[i] for i in range(N+1)]
parent = list(root)
for _ in range(Q):
q, *v = i2nn()
if q == 1:
X, Y = v
root[Y][0] = root[X]
root[Y] = [Y]
continue
elif q == 2:
X, = v
parent.append(root[X])
continue
else:
X, = v
cur = parent[X]
children = []
while type(cur[0]) != int:
children.append(cur)
cur = cur[0]
for child in children:
child[0] = cur
print(cur[0])
continue