qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    S = SI()
    T = SI()
    D = defaultdict(str)
    for s, t in zip(S, T):
        if D[s] == "":
            D[s] = t

        if D[s] != t:
            print("No")
            exit()
    print("Yes")


if __name__ == "__main__":
    main()

Fixed code:
import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    S = SI()
    T = SI()
    D = defaultdict(str)
    for s, t in zip(S, T):
        if D[s] == "":
            D[s] = t
        if D[s] != t:
            print("No")
            exit()
    if len(set(D.keys())) != len(set(D.values())):
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    main()
Buggy code:
s=list(input())
t=list(input())
ss=len(set(s))

l=[]
for i,j in zip(s,t):
    l.append(i+j)

if len(set(l)) == ss:
    print("Yes")
else:
    print("No")


Fixed code:
s=list(input())
t=list(input())
ss=len(set(s))
tt=len(set(t))

l=[]
for i,j in zip(s,t):
    l.append(i+j)

if len(set(l)) == ss == tt:
    print("Yes")
else:
    print("No")
Buggy code:
s = input()
t = input()
dct = dict()

bool =True
for a,b in zip(s,t):
    if a in dct and dct[a]!=b:
        bool =False
        break
    dct[a]=b
#print(dct)
#print(len(dct.values()))
#print(len(dct))
if len(dct.values())!=len(set(dct)):
    bool =False
print('Yes' if bool else 'No')

Fixed code:
s = input()
t = input()
dct = dict()

bool =True
for a,b in zip(s,t):
    if a in dct and dct[a]!=b:
        bool =False
        break
    dct[a]=b
#print(dct)
#print(len(dct.values()))
#print(len(dct))
a =dct.values()
if len(a)!=len(set(a)):
    bool =False
print('Yes' if bool else 'No')
Buggy code:
s = input()
t = input()
x,f = [-1]*26,1
for i in range(len(s)):
	if x[ord(s[i])-97]!=x[ord(t[i])-97]: f=0
	else: x[ord(s[i])-97],x[ord(t[i])-97] = i,i
if f: print("Yes")
else: print("No")

Fixed code:
s = input()
t = input()
x,y,f = [-1]*26,[-1]*26,1
for i in range(len(s)):
	if x[ord(s[i])-97]!=y[ord(t[i])-97]: f=0
	else: x[ord(s[i])-97],y[ord(t[i])-97] = i,i
if f: print("Yes")
else: print("No")
Buggy code:
s=list(input())
t=list(input())

import sys
dic_s={}
dic_t={}

for i in range(len(s)):
  a=dic_s.get(s[i],t[i])
  b=dic_t.get(t[i],s[i])
  if a!=t[i] or b!=s[i]:
    print(i,a,b)
    print("No")
    sys.exit()
  dic_s[s[i]]=t[i]
  dic_t[t[i]]=s[i]
print("Yes")



Fixed code:
s=list(input())
t=list(input())

import sys
dic_s={}
dic_t={}

for i in range(len(s)):
  a=dic_s.get(s[i],t[i])
  b=dic_t.get(t[i],s[i])
  if a!=t[i] or b!=s[i]:
    print("No")
    sys.exit()
  dic_s[s[i]]=t[i]
  dic_t[t[i]]=s[i]
print("Yes")
Buggy code:
def string_transformation():
    s = input()
    t = input()

    f = True
    dep = {}

    for sc,tc in zip(s,t):
        if dep.get(tc) is not None or (dep.get(tc) != sc and sc in dep.values()):
            print("No")
            f = False
            break
        else:
            dep[tc] = sc

    if f:
        print("Yes")

if __name__ == "__main__":
    string_transformation()

Fixed code:
def string_transformation():
    s = input()
    t = input()

    f = True
    dep = {}

    for sc,tc in zip(s,t):
        if (dep.get(tc) is not None or sc in dep.values()) and sc != dep.get(tc):
            print("No")
            f = False
            break
        else:
            dep[tc] = sc

    if f:
        print("Yes")

if __name__ == "__main__":
    string_transformation()
Buggy code:
# -*- coding: utf-8 -*-
"""
Created on Fri May 17 00:23:37 2019

@author: avina
"""

s1 = input().strip()
s2 = input().strip()
F = True
if len(set(s1)) == len(set(s2)):
  
  s = {}
  for i in range(len(s1)):
    if s2[i] not in s:
        s[s2[i]] = s1[i]
    elif s[s2[i]] != s1[i]:
        F = False
        break
  if F:
    print('Yes')
  else:
    print('No')
else:
   print('NO') 
    

Fixed code:
# -*- coding: utf-8 -*-
"""
Created on Fri May 17 00:23:37 2019

@author: avina
"""

s1 = input().strip()
s2 = input().strip()
F = True
d = {}
s = {}
for i in range(len(s1)):
  if s2[i] not in s:
     s[s2[i]] = s1[i]
  elif s[s2[i]] != s1[i]:
      F = False
      break
for i in range(len(s1)):
  if s1[i] not in d:
     d[s1[i]] = s2[i]
  elif d[s1[i]] != s2[i]:
      F = False
      break

if F:
   print('Yes')
else:
   print('No')
Buggy code:
# -*- coding: utf-8 -*-
"""
Created on Fri May 17 12:54:56 2019

@author: avina
"""

S = input()
T = input()
S_map = {}
T_map = {}
l = len(S)
S_cnt = 0
T_cnt = 0
for i in range(l):
	s,t = S[i], T[i]
	if s in S_map:
		s_id = S_map[s]
	else:
		s_id = S_cnt
		S_map[s] = S_cnt
		S_cnt += 1
	if t in T_map:
		t_id = T_map[t]
	else:
		t_id = T_cnt
		T_map[t] = T_cnt
		T_cnt += 1
	if s_id != t_id:
		print("No")
		break
print("Yes")

Fixed code:
# -*- coding: utf-8 -*-
"""
Created on Fri May 17 12:54:56 2019

@author: avina
"""

S = input()
T = input()
S_map = {}
T_map = {}
l = len(S)
k = 0
S_cnt = 0
T_cnt = 0
for i in range(l):
	s,t = S[i], T[i]
	if s in S_map:
		s_id = S_map[s]
	else:
		s_id = S_cnt
		S_map[s] = S_cnt
		S_cnt += 1
	if t in T_map:
		t_id = T_map[t]
	else:
		t_id = T_cnt
		T_map[t] = T_cnt
		T_cnt += 1
	if s_id != t_id:
		print("No");k+=1
		break
if k == 0:
    print("Yes")
Buggy code:
S = input()
T = input()

S_list = []
T_list = []
print(S_list)
print(T_list)
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS > 0:
        S_list.append(SS)
    if TT > 0:
        T_list.append(TT)

if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')

Fixed code:
S = input()
T = input()

S_list = []
T_list = []
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS > 0:
        S_list.append(SS)
    if TT > 0:
        T_list.append(TT)

if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')
Buggy code:
from collections import defaultdict

d1=defaultdict(lambda:'AA')
d2=defaultdict(lambda:'AA')
S=input()
T=input()
flag =True
for i in range(len(S)):
	if d1[S[i]]!='AA':
		if d1[S[i]] != T[i]:
			flag = False
			break
	d1[S[i]]=T[i]

if flag:
	print('Yes')
else:
	print('No')

Fixed code:
from collections import defaultdict

d1=defaultdict(lambda:'AA')
d2=defaultdict(lambda:'AA')
S=input()
T=input()
flag =True
for i in range(len(S)):
	if d1[S[i]]!='AA':
		if d1[S[i]] != T[i]:
			flag = False
			break
	if d2[T[i]]!='AA':
		if d2[T[i]]!=S[i]:
			flag =False
			break
	d1[S[i]]=T[i]
	d2[T[i]]=S[i]
if flag:
	print('Yes')
else:
	print('No')
Buggy code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  rep = dict()
  for c1, c2 in zip(S, T):
    if (c1 in rep) and (rep[c1] == c2):
      continue
    elif (c1 not in rep):
      rep[c1] = c2
    else:
      ans = 'No'
      break
  print(ans)


if __name__ == '__main__':
  main()

Fixed code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  S2T = dict()
  T2S = dict()
  for c1, c2 in zip(S, T):
    if (c1 in S2T) and (c2 in T2S):
      if (S2T[c1] == c2) and (T2S[c2] == c1):
        continue
      else:
        ans = 'No'
        break
    elif (c1 in S2T):
      if S2T[c1] == c2:
        T2S[c2] = c1
        continue
      else:
        ans = 'No'
        break
    elif (c2 in T2S):
      if T2S[c2] == c1:
        S2T[c1] == c2
        continue
      else:
        ans = 'No'
        break
    else:
      S2T[c1] = c2
      T2S[c2] = c1
  print(ans)


if __name__ == '__main__':
  main()
Buggy code:
from collections import Counter as cnt
fnc = lambda: cnt(cnt(input()).values())
print("Yes" if fnc == fnc else "No")

Fixed code:
from collections import Counter as cnt
fnc = lambda: cnt(cnt(input()).values())
print("Yes" if fnc() == fnc() else "No")
Buggy code:
s = list(input())
t = list(input())
dic = {}
flg = 'Yes'
for i in range(len(s)):
    if s[i] in dic.keys():
        if t[i] !=  dic.values(s[i]):
            flg = 'No'
    else:
        dic[s[i]] = t[i]
print(flg)

Fixed code:
s = list(input())
t = list(input())
dic = {}
flg = 'Yes'
for i in range(len(s)):
    if s[i] in dic.keys():
        if dic[s[i]] != t[i]:
            flg = 'No'
    else:
        dic[s[i]] = t[i]
dic2 = {}
for i in range(len(s)):
    if t[i] in dic2.keys():
        if dic2[t[i]] != s[i]:
            flg = 'No'
    else:
        dic2[t[i]] = s[i]
#print(dic)
print(flg)
Buggy code:
s=sorted(map(list(input()).count,set(s)))
t=sorted(map(list(input()).count,set(t)))
print("Yes" if s==t else "No")

Fixed code:
s=list(input())
t=list(input())
S=sorted(map(s.count,set(s)))
T=sorted(map(t.count,set(t)))
print("Yes" if S==T else "No")
Buggy code:
def check():
    s=input()
    t=input()

    d={}

    for i in range(len(s)):
        si=s[i]
        ti=t[i]
        if not si in d:
            d[si]=ti
        else:
            if d[si]==ti:
                continue
            else:
                return "No"
            
    vals=d.values()
    if len(vals)==len(set(vals)):
        return "Yes"
    else:
        return "No"
    

Fixed code:
def check():
    s=input()
    t=input()

    d={}

    for i in range(len(s)):
        si=s[i]
        ti=t[i]
        if not si in d:
            d[si]=ti
        else:
            if d[si]==ti:
                continue
            else:
                return "No"
            
    vals=d.values()
    if len(vals)==len(set(vals)):
        return "Yes"
    else:
        return "No"
print(check())
Buggy code:
def solve(string):
    s, t = map(int, string.split())

    c_s = sorted([s.count(_c) for _c in set(s)])
    c_t = sorted([t.count(_c) for _c in set(t)])

    if c_s == c_t:
        return "Yes"
    else:
        return "No"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Fixed code:
def solve(string):
    s, t = string.split()

    c_s = sorted([s.count(_c) for _c in set(s)])
    c_t = sorted([t.count(_c) for _c in set(t)])

    if c_s == c_t:
        return "Yes"
    else:
        return "No"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
Buggy code:
s=input()
t=inpur()
arr1=[0]*26
arr2=[0]*26
check='abcdefghijklmnopqrstuvwxyz'
for i in range(26):
  arr1[i]=s.count(check[i])
  arr2[i]=s.count(check[i])
arr1=sorted(arr1)
arr2=sorted(arr2)
for i in range(26):
  if arr1[i]!=arr2[i]:
    print('No')
    break
else:
  print('Yes')

Fixed code:
s=input()
t=input()
arr1=[0]*26
arr2=[0]*26
check='abcdefghijklmnopqrstuvwxyz'
for i in range(26):
  arr1[i]=s.count(check[i])
  arr2[i]=t.count(check[i])
arr1=sorted(arr1)
arr2=sorted(arr2)
for i in range(26):
  if arr1[i]!=arr2[i]:
    print('No')
    break
else:
  print('Yes')
Buggy code:
from  collections import Counter

S = input()
T = input()

s_counter = Counter(S)
t_counter = Counter(T)

if sorted(s_counter.values()) == sorted(s_counter.values()):
    print('Yes')
else:
    print('No')


Fixed code:
from  collections import Counter

S = input()
T = input()

s_counter = Counter(S)
t_counter = Counter(T)

if sorted(s_counter.values()) == sorted(t_counter.values()):
    print('Yes')
else:
    print('No')
Buggy code:
import collections

s = input()
t = input()
S = collections.Counter(s)
T = collections.Counter(t)

if S.values()==T.values():
	print("Yes")
else:
	print("No")

Fixed code:
import collections

s = input()
t = input()
S = collections.Counter(s)
T = collections.Counter(t)

if sorted(S.values())==sorted(T.values()):
	print("Yes")
else:
	print("No")
Buggy code:
s = input()
t = input()
dic1 = {}
dic2 = {}
for i in range(len(s)):
    if dic1.get(s[i]) == None:
        dic1[s[i]] = t[i]
    elif dic1[s[i]] != t[i] 
        print("No")
        exit()
    if dic2.get(t[i]) == None:
        dic2[t[i]] = s[i]
    elif dic2[t[i]] != s[i]:
        print("No")
        exit()
print("Yes")

Fixed code:
s = input()
t = input()
dic1 = {}
dic2 = {}
for i in range(len(s)):
    if dic1.get(s[i]) == None:
        dic1[s[i]] = t[i]
    elif dic1[s[i]] != t[i]:
        print("No")
        exit()
    if dic2.get(t[i]) == None:
        dic2[t[i]] = s[i]
    elif dic2[t[i]] != s[i]:
        print("No")
        exit()
print("Yes")
Buggy code:
S = input()
T = input()

i = 0
j = 0
ss = list()
tt = list()
slist = list()
tlist = list()

if len(s) == len(t):
   for s in S:
      if s in slist:
         ss.append(slist[s])
      else:
         ss.append(i)
         slist.append(s)
         i += 1

   for t in T:
      if t in tlist:
         tt.append(tlist[t])
      else:
         tt.append(j)
         tlist.append(t)
         j += 1

   if ss == tt:
      print("Yes")
   else:
      print("No")
else:
   print("No")
      
      
         


Fixed code:
S = input()
T = input()

i = 0
j = 0
ss = list()
tt = list()
slist = list()
tlist = list()

if len(S) == len(T):
   for s in S:
      if s in slist:
         ss.append(slist.index(s))
      else:
         ss.append(i)
         slist.append(s)
         i += 1

   for t in T:
      if t in tlist:
         tt.append(tlist.index(t))
      else:
         tt.append(j)
         tlist.append(t)
         j += 1

   if ss == tt:
      print("Yes")
   else:
      print("No")
else:
   print("No")
Buggy code:
def main():
    import copy
    s, t = input(), input()
    a = [[] for _ in range(26)]
    b = copy.deepcopy(a)
    for i, j in zip(s, t):
        x, y = map(lambda x: ord(x) - 97, [i, j])
        a[x].append(y)
        b[y].append(x)

    f = all(len(set(i)) for i in a)
    g = all(len(set(i)) for i in a)
    print("Yes" if f and g else "No")


if __name__ == '__main__':
    main()


Fixed code:
def main():
    import copy
    s, t = input(), input()
    a = [[] for _ in range(26)]
    b = copy.deepcopy(a)
    for i, j in zip(s, t):
        x, y = map(lambda x: ord(x) - 97, [i, j])
        a[x].append(y)
        b[y].append(x)

    f = all(len(set(i)) <= 1 for i in a)
    g = all(len(set(i)) <= 1 for i in b)
    print("Yes" if f and g else "No")


if __name__ == '__main__':
    main()
Buggy code:
import sys
sys.setrecursionlimit(10**6)

S = list(input())
T = list(input())
ret = 'Yes'
t = {}
for i in range(len(S)):
    if S[i] in t:
        if t[S[i]] == T[i]:
            continue
        else:
            ret = 'No'
    if ret == 'No':
        break
    t[S[i]] = T[i]

print(ret)


Fixed code:
import sys
sys.setrecursionlimit(10**6)

S = list(input())
T = list(input())
ret = 'Yes'
t = {}
for i in range(len(S)):
    if S[i] in t:
        if t[S[i]] == T[i]:
            continue
        else:
            ret = 'No'
    if ret == 'No':
        break
    t[S[i]] = T[i]

if ret == 'No':
    print(ret)
elif len(t) == len(set(t.values())):
    print('Yes')
else:
    print('No')
Buggy code:
import sys
from collections import defaultdict
s = input()
t = input()
d1 = defaultdict(set)
d2 = defaultdict(set)

for i in range(len(s)):
    d1[t[i]].add(s[i])
    d2[s[i]].add(t[i])
    print(d1,d2)
    if len(d1[t[i]])>1 or len(d2[s[i]])>1:
        print("No")
        sys.exit()
print("Yes")


Fixed code:
import sys
from collections import defaultdict
s = input()
t = input()
d1 = defaultdict(set)
d2 = defaultdict(set)

for i in range(len(s)):
    d1[t[i]].add(s[i])
    d2[s[i]].add(t[i])
    if len(d1[t[i]])>1 or len(d2[s[i]])>1:
        print("No")
        sys.exit()
print("Yes")
Buggy code:
from sys import stdin
import fractions

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
sli = []
li = []
for i in range(len(s)):
    sli.append(s[i])
    if s[i] != t[i]:
        li.append((s[i],t[i]))
li.sort()
sli = list(set(sli))

for i in range(len(li)-1):
    if li[i][0] == li[i+1][0]:
        if li[i][1] != li[i+1][1]:
            print("No")
            exit()
    if li[i][1] not in sli:
        print("No")
        exit()

li.sort(key=lambda x:(x[1]))

for i in range(len(li)-1):
    if li[i][0] != li[i+1][0]:
        if li[i][1] == li[i+1][1]:
            print("No")
            exit()

print("Yes")

Fixed code:
from sys import stdin
import fractions

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()

li = []
for i in range(len(s)):
    li.append((s[i],t[i]))
li.sort()

for i in range(len(li)-1):
    if li[i][0] == li[i+1][0]:
        if li[i][1] != li[i+1][1]:
            print("No")
            exit()

li.sort(key=lambda x:(x[1]))

for i in range(len(li)-1):
    if li[i][0] != li[i+1][0]:
        if li[i][1] == li[i+1][1]:
            print("No")
            exit()

print("Yes")
Buggy code:
def main():

    S = input()
    T = input()

    if len(S) != len(T):
        return "No"
    d = dict()
    for i in range(len(S)):
        if S[i] not in d:
            d[S[i]] = T[i]
        else:
            if d[S[i]] != T[i]:
                return "No"
    return "Yes"

if __name__ == '__main__':
    print(main())

Fixed code:
def main():

    S = list(input())
    T = list(input())

    d = dict()
    d_inv = dict()
    for i in range(len(S)):
        if S[i] not in d:
            if T[i] in d_inv:
                return "No"
            else:
                d[S[i]] = T[i]
                d_inv[T[i]] = S[i]
        else:
            if d[S[i]] != T[i]:
                return "No"
    return "Yes"
        
if __name__ == '__main__':
    print(main())
Buggy code:
S = list(map(str, input()))
T = list(map(str, input()))

dic, dic_2 = dict(), dict()

def dictionary_append(dictionary, lst):
	id = 0
	for s in lst:
		if not s in dictionary:
			dictionary[s] = []	
		dictionary[s].append(id)
		id += 1

dictionary_append(dic, S)
dictionary_append(dic_2, T)
	
s_prime	= list(dic.values())
t_prime = list(dic_2.values())
s_prime.sort()
t_prime.sort()

print(s_prime, t_prime)

no_flg = 0
for s, t in zip(s_prime, t_prime):
	if not s == t:
		print("No")
		no_flg = 1
		break
if not no_flg:
	print("Yes")

Fixed code:
S = list(map(str, input()))
T = list(map(str, input()))

dic, dic_2 = dict(), dict()

def dictionary_append(dictionary, lst):
	id = 0
	for s in lst:
		if not s in dictionary:
			dictionary[s] = []	
		dictionary[s].append(id)
		id += 1

dictionary_append(dic, S)
dictionary_append(dic_2, T)
	
s_prime	= list(dic.values())
t_prime = list(dic_2.values())
s_prime.sort()
t_prime.sort()


no_flg = 0
for s, t in zip(s_prime, t_prime):
	if not s == t:
		print("No")
		no_flg = 1
		break
if not no_flg:
	print("Yes")
Buggy code:
from collections import Counter

S = list(input())
T = list(input())

cs = sorted(Counter(S).values())
ct = sorted(Counter(T).values())

print(cs)
print(ct)

if cs == ct:
    print('Yes')
else:
    print('No')

Fixed code:
from collections import Counter

S = list(input())
T = list(input())

cs = sorted(Counter(S).values())
ct = sorted(Counter(T).values())

if cs == ct:
    print('Yes')
else:
    print('No')
Buggy code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
RC110C
"""


s = list(input())
t = list(input())
n = len(s)

def exchange(a,b,c):
    if a != b and a!=c:
        return(a)
    elif a == b:
        return(c)
    elif a == c:
        return(b)

ans = 'Yes'

seen = set()
for i in range(n):
    sl = s.pop()
    tl = t.pop()
    if sl == tl:
        seen.add(sl)
    elif sl != tl and not tl in seen and not sl in seen:
        s = list(map(lambda a: exchange(a,sl,tl),s))
        seen.add(tl)
    else:
        ans = 'No'
        break
    print(s)

print(ans)





Fixed code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
RC110C
"""


s = list(input())
t = list(input())
n = len(s)

def exchange(a,b,c):
    if a != b and a!=c:
        return(a)
    elif a == b:
        return(c)
    elif a == c:
        return(b)

ans = 'Yes'

seen = set()
for i in range(n):
    sl = s.pop()
    tl = t.pop()
    if sl == tl:
        seen.add(sl)
    elif sl != tl and not tl in seen and not sl in seen:
        s = list(map(lambda a: exchange(a,sl,tl),s))
        seen.add(tl)
    else:
        ans = 'No'
        break

print(ans)
Buggy code:
s_str = [ord(i) for i in input()]
t_str = [ord(i) for i in input()]

s = sorted(s_str)
t = sorted(t_str)

cnt_s = 1
cnt_t = 1
s_num = []
t_num = []

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        cnt_s += 1
        if i == len(s)-2:
            s_num.append(cnt_s)
    else:
        s_num.append(cnt_s)
        cnt_s = 1
    if t[i] == t[i+1]:
        cnt_t += 1
        if i == len(s)-2:
            t_num.append(cnt_t)
    else:
        t_num.append(cnt_t)
        cnt_t = 1

s_num = sorted(s_num)
t_num = sorted(t_num)
print(s_num)
print(t_num)

if s_num == t_num:
    print("Yes")
else:
    print("No")



Fixed code:
s_str = [ord(i) for i in input()]
t_str = [ord(i) for i in input()]

s = sorted(s_str)
t = sorted(t_str)

cnt_s = 1
cnt_t = 1
s_num = []
t_num = []

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        cnt_s += 1
        if i == len(s)-2:
            s_num.append(cnt_s)
    else:
        s_num.append(cnt_s)
        cnt_s = 1
    if t[i] == t[i+1]:
        cnt_t += 1
        if i == len(s)-2:
            t_num.append(cnt_t)
    else:
        t_num.append(cnt_t)
        cnt_t = 1

s_num = sorted(s_num)
t_num = sorted(t_num)

if s_num == t_num:
    print("Yes")
else:
    print("No")
Buggy code:
S=input()
T=input()

dict_S={}
dict_T={}

for x, y in zip(S, T):
    if x not in dict_S:
        dict_S[x]=y
    else:
        if dict_S[x]!=y:
            print("No")
            break

    if y not in dict_T:
        dict_T[y]=x
    else:
        if dict_T[y]!=x:
            print("No")
            break

print("Yes")

Fixed code:
S=input()
T=input()

dict_S={}
dict_T={}

for x, y in zip(S, T):
    if x not in dict_S:
        dict_S[x] = y
    else:
        if dict_S[x] != y:
            print("No")
            exit()

    if y not in dict_T:
        dict_T[y] = x
    else:
        if dict_T[y] != x:
            print("No")
            exit()


print("Yes")
Buggy code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

s = list(input())
t = list(input())

l='abcdefghijklmnopqrstuvwxyz'
if len(set(t)) == len(set(s)):
    print('No')
    exit()

for item in l:
    can = [i for i, x in enumerate(t) if x == item]
    if len(can) > 1:
        d = [s[i] for i in can]
        if len(set(d)) != 1:
            print('No')
            exit()
print('Yes')


Fixed code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

s = list(input())
t = list(input())

l='abcdefghijklmnopqrstuvwxyz'

for item in l:
    can = [i for i, x in enumerate(t) if x == item]
#    print(can)
    if len(can) > 1:
        d = [s[i] for i in can]
        if len(set(d)) != 1:
            print('No')
            exit()
for item in l:
    can = [i for i, x in enumerate(s) if x == item]
#    print(can)
    if len(can) > 1:
        d = [t[i] for i in can]
        if len(set(d)) != 1:
            print('No')
            exit()
print('Yes')
Buggy code:
s = input()
t = input()

dict_st = {}
dict_st = {}

for x, y in zip(s, t):
    if x not in dict_st:
        dict_st[x] = y 
    else:
        if dict_st[x] != y:
            print("No")
            break

    if y not in dict_ts:
        dict_ts[y]=x
    else:
        if dict_ts[y]!=x:
            print("No")
            break
else:
    print("Yes")

Fixed code:
s = input()
t = input()

dict_st = {}
dict_ts = {}

for x, y in zip(s, t):
    if x not in dict_st:
        dict_st[x] = y 
    else:
        if dict_st[x] != y:
            print("No")
            break

    if y not in dict_ts:
        dict_ts[y]=x
    else:
        if dict_ts[y]!=x:
            print("No")
            break
else:
    print("Yes")