Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

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

MOD = 10 ** 9 + 7
ans = 0
m = 1
ans = 0
for _ in range(60):
    one_count = 0
    for a in aaa:
        one_count += a & m
    one_count //= m
    zero_count = n - one_count
    ans = (ans + one_count * zero_count * m) % MOD
    m *= 2
        
print(ans)


### FIXED CODE ###

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

MOD = 10 ** 9 + 7
ans = 0
m = 1
ans = 0
for _ in range(60):
    one_count = sum(a & m for a in aaa)
    one_count //= m
    zero_count = n - one_count
    ans = (ans + one_count * zero_count * m) % MOD
    m *= 2
        
print(ans)
### BUGGY CODE ###

import string

cs = string.ascii_lowercase
def factor(n):
    b = 26
    ds = [n % b]
    n //= b
    while n:
        d = n % b
        ds.append(d)
        n //= b
    return ds

n = int(input())
lst = [sum(26**i for i in range(p+1)) - 1 for p in range(1, 12)]
lst = [0] + lst
for i in range(1, len(lst)):
    if n < lst[i]:
        pos = n - lst[i - 1] - 1
        fp = factor(pos)
        while len(fp) < i:
            fp.append(0)
        fp.reverse()

        print(''.join(cs[d] for d in fp))
        break


### FIXED CODE ###

import string

cs = string.ascii_lowercase
def factor(n):
    b = 26
    ds = [n % b]
    n //= b
    while n:
        d = n % b
        ds.append(d)
        n //= b
    return ds

n = int(input())
lst = [
26
,676
,17576
,456976
,11881376
,308915776
,8031810176
,208827064576
,5429503678976
,141167095653376
,3670344486987776
,95428956661682176
]
acc = [sum(lst[:i]) for i in range(len(lst))]
for i, (an1, an) in enumerate(zip(acc, acc[1:]), 1):
    if n < an + 1:
        pos = n - an1 - 1
        fp = factor(pos)
        while len(fp) < i:
            fp.append(0)
        fp.reverse()

        print(''.join(cs[d] for d in fp))
        break
### BUGGY CODE ###



from math import factorial
S=list(map(int,input()))
S.reverse()
count2019 = [0]*2019
count2019[0]=1
mod2019 = 0
d = 1
for i in S:
    mod2019 =mod2019+int(i)*d
    mod2019%=2019
    count2019[mod2019] +=1
    d *= 10
    d%2019
ans =0
for i in count2019:
   ans+= i*(i-1)//2
print(ans)
# print(count2019)

### FIXED CODE ###

s = list(input())
# s = list(str(10**200000))
n = len(s)
ans = 0
s.reverse()
# print(s)
x = 1
tot = 0
count = [0]*2019
for i in range(n):
    count[tot]+=1
    tot += int(s[i])*x
    # print(tot)
    tot %= 2019
    ans += count[tot]
    x = x*10%2019
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
x = 1
for i in range(N):
    x *= A[i]
if x > 10 ** 18:
    print(-1)
else:
    print(x)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
m = 10 ** 18
ans = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        if A[i] >= m:
            print(-1)
            exit()
    A = sorted(A)
    A = reversed(A)
    for i in A:
        ans *= i
        if ans > m:
            ans = -1
            break
    print(ans)
### BUGGY CODE ###

N, K = map(int, input().split())
array = []
for i in range(N):
    a, b = map(int, input().split())
    array += [a]*b
array.sort()
print(array[K-1])


### FIXED CODE ###

N, K = map(int, input().split())
abn = [list(map(int, input().split())) for _ in range(N)]
abn.sort()
pool = 0
for ab in abn:
    pool += ab[1]
    if pool >= K:
        print(ab[0])
        break
### BUGGY CODE ###

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

set_A = set(A)

for num in set_A:
    count_num = A.count(num)

    #望ましい数より大きい場合
    if count_num >= num:
        ans += count_num - num
    #望ましい数より小さい場合は0まで削る。
    else:
        ans += count_num

print(ans)


### FIXED CODE ###

N = int(input())
A = sorted(list(map(int, input().split())))
ans = 0
before_num = A[0]
num_count = 1
A.append(-1)#一番大きい数を計算するとき用

for num in A[1:]:
    if num == before_num:
        num_count += 1
    else:
        if num_count >= before_num:
            ans += num_count - before_num
        else:
            ans += num_count
        num_count = 1
        before_num = num

print(ans)
### BUGGY CODE ###

import numpy as np
from collections import deque
import sys

@np.vectorize
def trans(s):
    return 1 if s == "#" else 0

def parse(inp):
    H, W = map(int, next(inp).split())
    return np.array([trans([w for w in next(inp).strip()]) for _ in range(H)])

def search(S, start, C):
    Q = deque([start])
    H, W = S.shape
    n0 = 0
    n1 = 0
    while Q:
        i, j = Q.popleft()
        if C[i, j] != 0:
            continue
        else:
            C[i, j] = 1
            if S[i, j] == 0:
                n0 += 1
            else:
                n1 += 1
        if i + 1 < H and C[i+1, j] == 0 and S[i, j] != S[i+1, j]:
            Q.append((i + 1, j))
        if i > 0 and C[i-1, j] == 0 and S[i, j] != S[i-1, j]:
            Q.append((i - 1, j))
        if j + 1 < W and C[i, j+1] == 0 and S[i, j] != S[i, j+1]:
            Q.append((i, j + 1))
        if j > 0 and C[i, j-1] == 0 and S[i, j] != S[i, j-1]:
            Q.append((i, j - 1))
    return n0, n1


def search_all(S):
    C = np.full_like(S, 0)
    D = np.full_like(S, 0)
    ret = 0
    for i in range(S.shape[0]):
        for j in range(S.shape[1]):
            if D[i, j] == 0:
                n0, n1 = search(S, (i, j), C)
                D += C
                ret += n1 * n0
                if np.all(D):
                    return ret
                else:
                    C[:, :] = 0

    
print(search_all(parse(sys.stdin)))

### FIXED CODE ###


import numpy as np
from collections import deque
import sys

def parse(inp):
    H, W = map(int, next(inp).split())
    return np.array([list(next(inp).strip()) for _ in range(H)])

dis = [0, 0, 1, -1]
djs = [1, -1, 0, 0]

def search(S, i, j, Q, R):
    H, W = S.shape
    R[i, j] = True
    Q.append((i, j))
    n0 = 0
    n1 = 0
    while Q:
        i, j = Q.popleft()
        if S[i, j] == "#":
            n1 += 1
        else:
            n0 += 1
        gen = ((i + di, j + dj) for di, dj in zip(dis, djs))
        ijs = (g for g in gen if 0 <= g[0] and g[0] < H and 0 <= g[1] and g[1] < W)
        for ni, nj in ijs:
            if not R[ni, nj] and S[ni, nj] != S[i, j]:
                R[ni, nj] = True
                Q.append((ni, nj))
    return n0 * n1


def test(S):
    i, j = 0, 0
    Q = deque()
    R = np.full(S.shape, False)
    H, W = S.shape
    n = 0
    for i in range(H):
        for j in range(W):
            if not R[i, j]:
                n += search(S, i, j, Q, R)
    return n

print(test(parse(sys.stdin)))
### BUGGY CODE ###

from heapq import heappush, heappop
from collections import deque
n, x, y = list(map(int, input().split()))
G = [[]*n for _ in range(n)]

for i in range(n-1):
    G[i].append((i+1, 1))
    G[i+1].append((i, 1))
G[x-1].append((y-1, 1))
G[y-1].append((x-1, 1))
# print(G)
INF = 10**30
N = n


# s: 開始頂点
# N: 頂点数
# G: グラフ
# G[v][i] = (w, d): 辺v-wのコストは d (0 or 1)
dd = []
for i in range(n):
    s = i
    dist = [10**9] * N
    S = deque([s])
    T = deque()
    dist[s] = 0

    d = 0
    while S:
        while S:
            v = S.popleft()
            for w, c in G[v]:
                if d+c < dist[w]:
                    dist[w] = d+c
                    if c:
                        T.append(w)
                    else:
                        S.append(w)
        S, T = T, S
        d += 1
    dd.append(dist)
for i in range(1, n):
    ans = 0
    for d in dd:
        ans += d.count(i)
    print(ans//2)


### FIXED CODE ###

from collections import defaultdict
from heapq import heappush, heappop
from collections import deque
n, x, y = list(map(int, input().split()))
G = [[]*n for _ in range(n)]

for i in range(n-1):
    G[i].append((i+1, 1))
    G[i+1].append((i, 1))
G[x-1].append((y-1, 1))
G[y-1].append((x-1, 1))
# print(G)
INF = 10**30
N = n


# s: 開始頂点
# N: 頂点数
# G: グラフ
# G[v][i] = (w, d): 辺v-wのコストは d (0 or 1)
dd = []
for i in range(n):
    s = i
    dist = [10**9] * N
    S = deque([s])
    T = deque()
    dist[s] = 0

    d = 0
    while S:
        while S:
            v = S.popleft()
            for w, c in G[v]:
                if d+c < dist[w]:
                    dist[w] = d+c
                    if c:
                        T.append(w)
                    else:
                        S.append(w)
        S, T = T, S
        d += 1
    dd.append(dist)

ans = defaultdict(lambda: 0)
for dist in dd:
    for t in dist:
        ans[t] += 1
for i in range(n-1):
    print(ans[i+1]//2)
### BUGGY CODE ###

a, b, k = [int(x) for x in input().split()]

cnt = 0
while (cnt < k):
  cnt += 1
  if a > 0:
    a -= 1
  elif b > 0:
    b -= 1

print(a, b)

### FIXED CODE ###

a, b, k = [int(x) for x in input().split()]
cnt = a + b - k

if a > k:
  print(a-k, b)
elif b > k-a:
  print(0, b -(k-a))
else:
  print(0, 0)
### BUGGY CODE ###

a,b,k = map(int,input().split())
for i in range(k):
	if a - 1 >= 0:
		a = a-1
	elif b-1 >= 0:
		b = b-1
print(a,b)


### FIXED CODE ###

a,b,k = map(int,input().split())
if k <= a:
	print(a-k,b)
elif k <= a+b:
	print(0,b-(k-a))
else:
	print(0,0)
### BUGGY CODE ###

import sys
from heapq import heappop, heappush

n, m, ss, *uvabcd = map(int, sys.stdin.buffer.read().split())
uuu = uvabcd[0:4 * m:4]
vvv = uvabcd[1:4 * m:4]
aaa = uvabcd[2:4 * m:4]
bbb = uvabcd[3:4 * m:4]
ccc = uvabcd[4 * m + 0::2]
ddd = uvabcd[4 * m + 1::2]
links = [set() for _ in range(n)]

for u, v, a, b in zip(uuu, vvv, aaa, bbb):
    u -= 1
    v -= 1
    links[u].add((v, a, b))
    links[v].add((u, a, b))

INF = 10 ** 18
ans = [INF] * n

q = [(0, ss, 0)]  # (time, silver, city)
visited = set()
fixed = 0
while q:
    t, s, v = heappop(q)
    if (s, v) in visited:
        continue
    visited.add((s, v))
    if ans[v] == INF:
        ans[v] = t
        fixed += 1
        if fixed == n:
            break

    for u, a, b in links[v]:
        if s < a:
            continue
        ns = s - a
        if (ns, u) in visited:
            continue
        heappush(q, (t + b, ns, u))

    ts = s
    tt = t
    while ts < 2500:
        ts += ccc[v]
        tt += ddd[v]
        if (ts, v) not in visited:
            heappush(q, (tt, ts, v))
        else:
            break

print('\n'.join(map(str, ans[1:])))


### FIXED CODE ###

import sys
from heapq import heappop, heappush

n, m, ss = map(int, input().split())
lines = sys.stdin.readlines()
links = [set() for _ in range(n)]
aaa = []
for line in lines[:m]:
    u, v, a, b = map(int, line.split())
    u -= 1
    v -= 1
    links[u].add((v, a, b))
    links[v].add((u, a, b))
    aaa.append(a)

exchanges = []
for line in lines[m:]:
    c, d = map(int, line.split())
    exchanges.append((c, d))

req = sum(sorted(aaa, reverse=True)[:n - 1])
INF = 10 ** 18
ans = [INF] * n
ans_silver = [-1] * n

q = [(0, ss, 0)]  # (time, silver, city)
visited = set()
fixed = 0
while q:
    t, s, v = heappop(q)
    if (s, v) in visited or ans_silver[v] >= s:
        continue
    visited.add((s, v))
    if ans[v] == INF:
        ans[v] = t
        ans_silver[v] = s
        fixed += 1
        if fixed == n:
            break

    for u, a, b in links[v]:
        if s < a:
            continue
        ns = s - a
        nt = t + b
        if (ns, u) in visited or ans_silver[u] >= ns:
            continue
        heappush(q, (nt, ns, u))

    c, d = exchanges[v]
    ns = s + c
    if ns <= req and (ns, v) not in visited:
        heappush(q, (t + d, ns, v))

print('\n'.join(map(str, ans[1:])))
### BUGGY CODE ###

import itertools

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

for i in itertools.combinations(a,2):
	if i[0]==i[1]:
		print("NO")
		exit()
		
print("YES")

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
s=set(a)

if n==len(s):
	print("YES")
else:
	print("NO")
### BUGGY CODE ###

import sys
from collections import deque
H, W = map(int, input().split())
ROAD = set()
for h in range(H):
    for w, c in enumerate(sys.stdin.readline()):
        if c == ".":
            ROAD.add((h, w))

todo = deque()
done = set()
ans = 0
for s in ROAD:
    done.clear()
    todo.append((s, 0))
    while todo:
        p, count = todo.popleft()
        ans = max(ans, count)
        done.add(p)
        ncount = count + 1
        for dh, dw in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            np = (p[0] + dh, p[1] + dw)
            if not np in ROAD or np in done:
                continue
            todo.append((np, ncount))
print(ans)

### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
S = [input() + "#" for _ in range(H)]
S.append("#" * (W + 1))

todo = deque()
done = set()
ans = 0
for sh in range(H):
    for sw in range(W):
        if S[sh][sw] == "#":
            continue
        s = (sh, sw)
        done.clear()
        done.add(s)
        todo.append((s, 0))
        while todo:
            p, count = todo.popleft()
            ncount = count + 1
            for dh, dw in ((1, 0), (-1, 0), (0, 1), (0, -1)):
                nh, nw = p[0] + dh, p[1] + dw
                if S[nh][nw] == "#":
                    continue
                np = (nh, nw)
                if np in done:
                    continue
                done.add(np)
                ans = max(ans, ncount)
                todo.append((np, ncount))
print(ans)
### BUGGY CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

T = S()

def match(v):
    return int(v) % 2019 == 0

cnt = 0
A = []

for s in T:
    A.append(s)


for i in range(0, len(A)):
    x = ""
    x += A[i]
    for j in range(i+1, len(A)):
        x += A[j]
        if match(x):
            cnt += 1

print(cnt)

### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

T = S()

revT = reversed(T)

n, d, mods = 0, 1, [1]+[0]*2019

for i in revT:
    n = (n + int(i)*d)%2019
    d = d*10%2019
    mods[n] += 1

sum = 0
for j in mods:
    sum += j*(j-1)//2

print(sum)
### BUGGY CODE ###

S=input()
count=0
for i in range(4,len(S)+1):
    list=[S[idx:idx+i] for idx in range(len(S)-i+1) if int(S[idx:idx+i])%2019==0 ]
    count+=len(list)
print(count)


### FIXED CODE ###

S=list(map(int,list(input())))
N=len(S)

m=[0]*2019
m[0]=1
ans=0

sm=0
d=1
for i in range(N):
    sm=(sm+S[N-1-i]*d)%2019
    m[sm] += 1
    d=(d*10)%2019

for i in m:
    ans += i*(i-1)//2

print(ans)
### BUGGY CODE ###

N,K=map(int,input().split())
px = [0 for _ in range(N)]
py = [0 for _ in range(N)]
for i in range(N):
  px[i],py[i] = list(map(int,input().split()))
a=10**20
for xi in range(N):
  for xj in range(xi+1,N):
    for yi in range(N):
      for yj in range(yi+1,N):
        x0,x1,y0,y1=px[xi],px[xj],py[yi],py[yj]
        dx,dy = abs(x0-x1),abs(y0-y1)
        if a < dx*dy: continue
        cnt = 0
        for i in range(N):
          if (x0-px[i])*(px[i]-x1)>=0 and (y0-py[i])*(py[i]-y1)>=0: cnt += 1
        if cnt >= K: a = min(a, dx*dy)
print(a)


### FIXED CODE ###

N,K=map(int,input().split())
p = sorted([[int(_) for _ in input().split()] for i in range(N)])
a=10**20
for xi in range(N-K+1):
  for xj in range(xi+K-1,N):
    q = sorted(y for x,y in p[xi:xj+1])
    for yi in range(xj-(xi+K-1)+1):
      yj = yi+K-1 #Is the number always K?
      if q[yi]<=p[xi][1] and p[xj][1]<=q[yj]:
        a = min(a, (p[xi][0]-p[xj][0])*(q[yi]-q[yj]))
print(a)
### BUGGY CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

import heapq

N = I()
A = III()
B = III()

x = []
for i in range(N):
    heapq.heappush(x,[-B[i],i])

counter = 0

while x:
    temp = heapq.heappop(x)
    i = temp[1]
    b = -temp[0]
    a = B[(i-1)%N]
    c = B[(i+1)%N]
    if b == A[i]:
        continue
    elif b<A[i]:
        print(-1)
        exit()
    else:
        d,m = divmod(b-A[i],a+c)
        if d==0:
            print(-1)
            exit()
        elif m == 0:
            B[i] = A[i]
            counter += d
        else:
            B[i] = A[i]+m
            heapq.heappush(x,[-B[i],i])
            counter += d

print(counter)

### FIXED CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

import heapq

N = I()
A = III()
B = III()

x = []
for i,b in enumerate(B):
    heapq.heappush(x,(-b,i))

counter = 0

while x:
    temp = heapq.heappop(x)
    i = temp[1]
    b = -temp[0]
    a = B[(i-1)%N]
    c = B[(i+1)%N]
    if b == A[i]:
        continue
    elif b<A[i]:
        print(-1)
        exit()
    else:
        d,m = divmod(b-A[i],a+c)
        if d==0:
            print(-1)
            exit()
        elif m == 0:
            B[i] = A[i]
            counter = counter+d
        else:
            B[i] = A[i]+m
            heapq.heappush(x,(-B[i],i))
            counter = counter+d

print(counter)
### BUGGY CODE ###

import sys
from collections import deque
sys.setrecursionlimit(20001)
N, Q = map(int, input().split())
a_b = [list(map(int, input().split())) for _ in range(N-1)]
p_x = [list(map(int, input().split())) for _ in range(Q)]

rin = deque([[] for _ in range(N)])
for v in a_b:
    rin[v[0]-1].append(v[1]-1)
    rin[v[1]-1].append(v[0]-1)
    
score = [0 for _ in range(N)]
for ele in p_x:
    score[ele[0]-1] +=ele[1]
#print(score)

def dfs(p, bp=-1):
    for c in rin[p]:
        if c != bp:
            #print(c)
            score[c]+= score[p]
            dfs(c, p)




dfs(0)
print(*score)

### FIXED CODE ###

import sys
from collections import deque
sys.setrecursionlimit(1000000)

n,q = map(int, input().split())
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(n-1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(q)]

v = [deque([]) for i in range(n)]
for e in a_b:
    v[e[0]-1]+=[e[1]-1]
    v[e[1]-1]+=[e[0]-1]
score = [0 for i in range(n)]
for e in p_x:
    score[e[0]-1]+=e[1]
def dfs(p, bp=-1):
    while v[p]:
        c =v[p].popleft()
        if c ==bp:
            continue
        #print(p, c, bp)
        score[c]+=score[p]
        dfs(c, bp=p)
visited = [0]                
dfs(0)
print(*score)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))


    for _ in range(M):
        A.sort()
        A[-1] = A[-1] // 2

    print(sum(A))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import heapq 
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    A = list(map(lambda x : int(x) * -1, input().split()))
    heapq.heapify(A)

    for _ in range(M):
        a = heapq.heappop(A) * -1
        a = a // 2
        heapq.heappush(A, a * -1)

    print(sum(A) * -1)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

s = S()
t = S()
l = len(s)
S_Alphabet = [set() for _ in range(26)]
T_Alphabet = [set() for _ in range(26)]
# ord('a') = 97
for i in range(l):
    S_Alphabet[ord(s[i])-97].add(i)
    T_Alphabet[ord(t[i])-97].add(i)
    if S_Alphabet[ord(s[i])-97] != T_Alphabet[ord(t[i])-97]:
        print("No")
        exit()
else:
    print("Yes")


### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

s = S()
t = S()
l = len(s)
S_Alphabet = [-1]*26
T_Alphabet = [-1]*26
# ord('a') = 97
for i in range(l):
    si = ord(s[i])-97
    ti = ord(t[i])-97
    if S_Alphabet[si] == -1:
        S_Alphabet[si] = ti
    else:
        if S_Alphabet[si] == ti:
            continue
        else:
            print("No")
            exit()
    if T_Alphabet[ti] == -1:
        T_Alphabet[ti] = si
    else:
        if T_Alphabet[ti] == si:
            continue
        else:
            print("No")
            exit()
else:
    print("Yes")