qyliang/CodeNanoFix huggingface dataset:
Buggy code:
s=input()
a=s[0]
b=s[1]
c=s[2]
d=s[3]
if a==b and a!=c and b!=d and c==d:
  print("Yes")
if a!=b:
  if a==c and b==d and c!=d:
    print("Yes")
  if a!=c and a==d and b!=d:
    print("Yes")
else:
  print("No")

Fixed code:
s=input()
a=s[0]
b=s[1]
c=s[2]
d=s[3]
if a==b and a!=c and c==d:
  print("Yes")
elif a!=b and a==c and b==d:
  print("Yes")
elif a!=b and a==d and b==c:
  print("Yes")
else:
  print("No")
Buggy code:
## AABB
## ABBA
## ABAB

S = input().strip()
first_char = ['', 0]
second_char = ['', 0]
counter = 0
ans = True
for c in S:
    if counter == 0:
        first_char[0] = c
        first_char[1] += 1
    
    if counter == 1:
        if c != first_char:
            second_char[0] = c
            second_char[1] += 1
        else:
            first_char[1] += 1
            
    if counter >1:
        if(first_char[0] != c and second_char[0] != c):
            ans = False
            break
        if c == first_char[0]:
            first_char[1] += 1
            if first_char[1] > 2:
                ans = False
                break
                
        if c == second_char[0]:
            second_char[1] += 1
            if second_char[1] > 2:
                ans = False
                break
    counter += 1

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

Fixed code:
## AABB
## ABBA
## ABAB

S = input().strip()
first_char = ['', 0]
second_char = ['', 0]
counter = 0
ans = True
for c in S:
    if counter == 0:
        first_char[0] = c
        first_char[1] += 1
    
    if counter == 1:
        if c != first_char[0]:
            second_char[0] = c
            second_char[1] += 1
        else:
            first_char[1] += 1
            
    if counter >1:
        if second_char[0] == '':
            second_char[0] = c
            
        if(first_char[0] != c and second_char[0] != c):
            ans = False
            break
        if c == first_char[0]:
            first_char[1] += 1
            if first_char[1] > 2:
                ans = False
                break
                
        if c == second_char[0]:
            second_char[1] += 1
            if second_char[1] > 2:
                ans = False
                break
    counter += 1

if ans:
    print('Yes')
else:
    print('No')
Buggy code:
S = input()
a = S[0]
b = S[1]
c = S[2]
d = S[3]
l = []
l.append(a)
l.append(b)
l.append(c)
l.append(d)
k = set(l)
if len(k) == 2:
  if count(a) == 2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed code:
S = input()
a = S[0]
b = S[1]
c = S[2]
d = S[3]
l = []
l.append(a)
l.append(b)
l.append(c)
l.append(d)
k = list(set(l))
if len(k) == 2:
  if l.count(a) == 2:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy code:
import numpy as np

S = input()

moji = [i for i in S]

a = moji[0]
for i in range(len(moji)):
    if a != moji[i]:
        b = moji[i]
count = 1
count2 = 1
for i in range(1,len(moji)):
    if moji[i] == a:
        count += 1
    elif moji[i] == b:
        count2 += 1
if count == 2 and count2 == 2:
    print("Yes")
else:
    print("No")

Fixed code:
import numpy as np

S = input()

moji = [i for i in S]

a = moji[0]
for i in range(len(moji)):
    if a != moji[i]:
        b = moji[i]
count = 0
count2 = 0
for i in range(0,len(moji)):
    if moji[i] == a:
        count += 1
    elif moji[i] == b:
        count2 += 1
if count == 2 and count2 == 2:
    print("Yes")
else:
    print("No")
Buggy code:
import sys

li=list(input())
a=[0,0,0,0]
for i in range(4):
    a[i]=li.count(li[i]);
    if a[i]==2:
        continue
    else:
        print("No")
        sys.exit
print("Yes")


Fixed code:
import sys

li=list(input())
a=[0,0,0,0]
for i in range(4):
    a[i]=li.count(li[i]);
    if a[i]==2:
        continue
    else:
        print("No")
        sys.exit()
print("Yes")
Buggy code:
S = input()

if S[0] == S[1] && S[2] == S[3] && S[0] != S[2]:
  print('Yes')
elif S[0] == S[2] && S[1] == S[3] && S[0] != S[1]:
  print('Yes')
elif S[0] == S[3] && S[1] == S[2] && S[0] != S[1]:
  print('Yes')
else:
  print('No')

Fixed code:
S = input()
 
if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
  print('Yes')
elif S[0] == S[2] and S[1] == S[3] and S[0] != S[1]:
  print('Yes')
elif S[0] == S[3] and S[1] == S[2] and S[0] != S[1]:
  print('Yes')
else:
  print('No')
Buggy code:
s=sorted(input())
if s[0]==s[1]:
  if s[0]!=s[2] and s[2]==s[3]:
    print("Yes")
else:
  print("No")

Fixed code:
s=sorted(input())
if s[0]==s[1] and s[0]!=s[2] and s[2]==s[3]:
  print("Yes")
else:
  print("No")
Buggy code:
# A - Fifty-Fifty
A = str(input())
Acount =[]
ans = 'No'

for i in range(len(A)):
    if A.count(A[i]) == 2:
        ans = 'Yes'
    else:
        ans = 'No'

print(ans)

Fixed code:
# A - Fifty-Fifty
A = str(input())
Acount =[]
ans = 'No'

for i in range(len(A)):
    if A.count(A[i]) == 2:
        Acount.append(2)
    else:
        Acount.append(0)

if Acount == [2,2,2,2]:
	print('Yes')
else:
	print('No')
Buggy code:
S = input()
if len(set(S)) == 2:
	ans = 'Yes'  
else ans = 'No'
print(ans)

Fixed code:
S = input()
 
if len(set(S)) == 2:
  print('Yes')
else:
  print('No')
Buggy code:
s = input()
ans = False
if s[0] == s[1] :
  if s[0] != s[2] and s[2] ==s[3] :
  ans = True
elif s[0] == s[2] :
  if s[0] != s[1] and s[1] ==s[3] :
  ans = True
else s[0] == s[3] :
  if s[0] != s[1] and s[2] ==s[1] :
  ans = True
if ans :
  print('Yse')
else:
  print('No')

Fixed code:
s=input()
ans=False
if s[0]==s[1]:
    if s[0]!=s[2] and s[2]==s[3]:
        ans=True
elif s[0]==s[2]:
    if s[0]!=s[1] and s[1]==s[3]:
        ans=True
elif s[0]==s[3]:
    if s[0]!=s[1] and s[1]==s[2]:
        ans=True
if ans:
    print('Yes')
else:
    print('No')
Buggy code:
n= input()

n_list=list(n)

a=(n_list.count(n_list[0]))
b=(n_list.count(n_list[1]))
c=(n_list.count(n_list[2]))
d=(n_list.count(n_list[3]))
if a and b and c and d==2:
    print("Yes")
else:
    print("No") 

Fixed code:
n= input()

n_list=list(n)

a=(n_list.count(n_list[0]))
b=(n_list.count(n_list[1]))
c=(n_list.count(n_list[2]))
d=(n_list.count(n_list[3]))

if a==2:
    if b==2:
        if c==2:
            if d==2:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")
Buggy code:
s=input()
a=sorted(s)
print(a)
if a[0]==a[1] and a[2]==a[3]:
    print("Yes")
else:
    print("No")

Fixed code:
s = input()
s = sorted(s)
if s[0] == s[1] and s[1] != s[2] and s[2] == s[3]:
        print("Yes")
else:
        print("No")
Buggy code:
import collections
x=input()
y=[x[0],x[1],x[2],x[3]]
c = collections.Counter(y)
ans="Yes"
if(len(c))>3:
    ans="No"
if(ans=="Yes"):

    a=x.count(x[0])
    if(a>2):
        ans="No"



print(ans)


Fixed code:
import collections
x=input()
y=[x[0],x[1],x[2],x[3]]
c = collections.Counter(y)
ans="Yes"
if(len(c))>2:
    ans="No"
if(ans=="Yes"):

    a=x.count(x[0])
    if(a>2):
        ans="No"



print(ans)
Buggy code:
s=list(int(input()))

for ss in s:
  if s.count(ss)!=2:
    print("No")
	exit()
    
print("Yes")
  


Fixed code:
s=list(input())

for ss in s:
  if s.count(ss)!=2:
    print("No")
    exit()
    
print("Yes")
Buggy code:
s = input()

if len(set(s)) == 2 and s.count(s[0)) == 2:
    print('Yes')
else:
    print('No')    

Fixed code:
s = input()
set_s = set(s)
if len(set_s) ==2 and s.count(s[0]) == 2:
  print("Yes")
else:
  print("No")
Buggy code:
if len(set(input())) ==2: print("Yes)
else: print("No")                                

Fixed code:
s = set(input())
if len(s) == 2:
    print('Yes')
else:
    print('No')
Buggy code:
n=input()
k=sorted(n)
print(k)
if k[0]==k[1] and k[2]==k[3] and k[1]!=k[2]:
  print("Yes")
  
else:
  print("No")

Fixed code:
n=input()
k=sorted(n)
if k[0]==k[1] and k[2]==k[3] and k[1]!=k[2]:
  print("Yes")
  
else:
  print("No")
Buggy code:
S=input()
S.sort()
if (S[0]==S[1])and(S[2]==S[3])and(S[0]!=S[1]):
  print('Yes')
else:
  print('No')
    

Fixed code:
S=list(input())
S.sort()
if (S[0]==S[1])and(S[2]==S[3])and(S[0]!=S[2]):
  print('Yes')
else:
  print('No')
Buggy code:
word=input()
word=sorted(word)
print(word)

if word[0]==word[1] and word[2]==word[3]:
    if word[0]!=word[2] and word[1]!=word[3]:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Fixed code:
s = sorted(input())
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print("Yes")
else:
    print("No")
Buggy code:
import collections
S = input()
L = collections.Counter(S)
if len(L) == 2 and L[0][1] == 2:
  print('Yes')
else:
  print('No')


Fixed code:
import collections
S = input()
L = collections.Counter(S)
T = L.most_common()
if len(T) == 2 and T[0][1] == 2:
  print('Yes')
else:
  print('No')
Buggy code:
#132 a
s=list(input())
s.sort()
print(s)
if s[0]==s[1] and s[2]==s[3] and s[1]!=s[2]:
    print("Yes")
else:
    print("No")

Fixed code:
#132 a
s=list(input())
s.sort()
#print(s)
if s[0]==s[1] and s[2]==s[3] and s[1]!=s[2]:
    print("Yes")
else:
    print("No")
Buggy code:
S = list(input())

L = sorted(S)
if L[0]==L[1] and L[2]==L[3] and L[0]==L[2]:
    print('Yes')
else:
    print('No')

Fixed code:
S = list(input())

L = sorted(S)
if L[0]==L[1] and L[2]==L[3] and L[0]!=L[2]:
    print('Yes')
else:
    print('No')
Buggy code:
s = input()
if s[0] == s[1]:
    if s[2] == s[3]:
        print("Yes")
    else:
        print("No")
if s[0] == s[2]:
    if s[1] == s[3]:
        print("Yes")
    else:
        print("No")
if s[0] == s[3]:
    if s[1] == s[2]:
        print("Yes")
    else:
        print("No")

Fixed code:
s = input()
if s[0] == s[1] == s[2] == s[3]:
    print("No")
elif s[0] == s[1]:
    if s[2] == s[3]:
        print("Yes")
    else:
        print("No")
elif s[0] == s[2]:
    if s[1] == s[3]:
        print("Yes")
    else:
        print("No")
elif s[0] == s[3]:
    if s[1] == s[2]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy code:
s = list(input())
s.sort()
if s[0] == s[1] and s[2] == s[3] and a[1] != a[2]:
  print("Yes")
else:
  print("No")

Fixed code:
s = input()
s = list(s)
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[1] != s[2]:
    print("Yes")
else:
    print("No")
Buggy code:
import collections
S = input()
c = collections.Counter(S)

if (len(c.keys()) == 2 )and(c.values() == [2,2]):
  print("Yes")
else:
  print("No")

Fixed code:
import collections
S = input()
c = collections.Counter(S)
 

if (len(c.keys()) == 2 )and(list(c.values()) == [2,2]):
  print("Yes")
else:
  print("No")
Buggy code:
from collections import Counter as C

S = input()

c = C(S)
if len(c.keys())==2:
  if c.values[0]==2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed code:
from collections import Counter as C
 
S = input()
 
c = C(S)
if len(c.keys())==2:
  if list(c.values())[0]==2:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy code:
s = str(input())
x = {}
for i in range(4):
  if s[i] not in x.keys():
    x[s[i]] = 1
  else:
    x[s[i]] += 1
for i in x.items():
  if i != 2:
    print("No")
    exit()
print("Yes")
    

Fixed code:
s = str(input())
x = {}
for i in range(4):
  if s[i] not in x.keys():
    x[s[i]] = 1
  else:
    x[s[i]] += 1
for i in x.values():
  if i != 2:
    print("No")
    exit()
print("Yes")
Buggy code:
S=input()
L=[]
for i in range(3):
    L.apend(S.count(S[i]))
if sum(L)==6:
    print('Yes')
else:
    print('No')

Fixed code:
S=input()
L=[]
for i in range(3):
    L.append(S.count(S[i]))
if sum(L)==6:
    print('Yes')
else:
    print('No')
Buggy code:
s = input()
s = [ t for t in s ]
so = set(s)

if len(so) == 2 and  [ s.count(c) for c in so ] == [2,2] :
  print("yes")
else:
  print("No")



Fixed code:
s = input()
s = [ t for t in s ]
so = set(s)
 
if len(so) == 2 and  [ s.count(c) for c in so ] == [2,2] :
  print("Yes")
else:
  print("No")
Buggy code:
a = list(input())
a.sort()

if n[0] == n[1] and a[2]==a[3] and a[0]!==a[2]:
    print("Yes")

else:
    print("No")

Fixed code:
a = list(input())
a.sort()

if a[0] == a[1] and a[2]==a[3] and a[0]!=a[2]:
    print("Yes")

else:
    print("No")
Buggy code:
s = input()

if not s[0] == s[1] and s[1] == s[2] and s[2] == s[3]:
    if s[0] == s[1] and s[2] == s[3]:
        print("Yes")
    elif s[0] == s[2] and s[1] == s[3]:
        print("Yes")
    elif s[0] == s[3] and s[1] == s[2]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Fixed code:
s=input()
if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]:
    print("Yes")
elif s[0]==s[2] and s[1]==s[3] and s[0]!=s[1]:
    print("Yes")
elif s[0]==s[3] and s[1]==s[2] and s[1]!=s[0]:
    print("Yes")
else:
    print("No")
Buggy code:
import collections

string = str(input())

c = collections.Counter(list(string))

if c.values == [2, 2]:
    print('Yes')

else:
    print('No')


Fixed code:
import collections

string = str(input())

c = collections.Counter(list(string))
if list(c.values()) == [2, 2]:

    print('Yes')

else:
    print('No')
Buggy code:
inp=input()
ans=0
for s in inp:
  if inp.count(s)%2==2:
    ans=ans;
  else:
    ans+=1
if ans==0:
  print('Yes')
else:
  print('No')

Fixed code:
inp=input()
ans=0
for s in inp:
  if inp.count(s)==2:
    ans=ans;
  else:
    ans+=1
if ans==0:
  print('Yes')
else:
  print('No')
Buggy code:
S = list(input())

if (S[0] == S[1] and S[2] == S[3] and S[0] != S[1]) or (S[0] == S[2] and S[1] == S[3] and S[0] != S[1]) or (S[0] == S[3] and S[1] == S[2] and S[0] != S[1]):
    print("Yes")
else:
    print("No")

Fixed code:
S = list(input())

if (S[0] == S[1] and S[2] == S[3] and S[0] != S[2]) or (S[0] == S[2] and S[1] == S[3] and S[0] != S[1]) or (S[0] == S[3] and S[1] == S[2] and S[0] != S[1]):
    print("Yes")
else:
    print("No")
Buggy code:
s = sorted(input())
ans = 'YES' if s[0] == s[1] and s[1] != s[2] and s[2] == s[3] else 'No'
print(ans)


Fixed code:
s = sorted(input())
ans = 'Yes' if s[0] == s[1] and s[1] != s[2] and s[2] == s[3] else 'No'
print(ans)
Buggy code:
S = sorted(input())
print('Yes') if S[0] == S[1] and S[0] != S[2] and S[0] != S[3] else print('No')

Fixed code:
S = input()

T = sorted(S)
ans = (
    'Yes' if T[0] == T[1] and T[1] != T[2] and T[2] == T[3] else
    'No'
)

print(ans)
Buggy code:
s = list(input())
s.sort()
if s[0]==s[1] and  s[2]==s[3]:
  print(Yes)
else:
  print("No")

Fixed code:
s = list(input())
s.sort()
if s[0]==s[1] and  s[2]==s[3] and s[0]!=s[2]:
  print("Yes")
else:
  print("No")
Buggy code:
def main():
    import sys
    input = sys.stdin.readline
    
    a = sorted(input())
    if a[0] == a[1] and a[2] == a[3] and a[1] != a[2]:
        print("Yes")
    else:
        print("No")
    
    return 0

main()

Fixed code:
def main():
    import sys
    input = sys.stdin.readline
    
    a = sorted(input()[:-1])
    # print(a)
    if a[0] == a[1] and a[2] == a[3] and a[1] != a[2]:
        print("Yes")
    else:
        print("No")
    
    return 0

main()
Buggy code:
s = input()

if len(set(s)) == 2 and s. count(s[0]) == 2:
    print('Yes')
 else:
     print('No')

Fixed code:
s = input()

if len(set(s)) == 2 and s. count(s[0]) == 2:
    print('Yes')
else:
     print('No')
Buggy code:
s = input()
if s[0] == s[1] and s[1] == s[2]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3]:
    print('Yes')
elif s[0] == s[3] and s[1] == s[2]:
    print('Yes')
else:
    print('No')

Fixed code:
s = input()
if s[0] == s[1] == s[2] == s[3]:
    print('No')
elif s[0] == s[1] and s[2] == s[3]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3]:
    print('Yes')
elif s[0] == s[3] and s[1] == s[2]:
    print('Yes')
else:
    print('No')
Buggy code:
from collections import defaultdict
S = input()
t = defaultdict(int)
for i in s:
  t[i] += 1
if len(t.keys()) == 2:
  for i in t.values():
    if i != 2:
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")

Fixed code:
from collections import defaultdict
S = input()
t = defaultdict(int)
for i in S:
  t[i] += 1
if len(t.keys()) == 2:
  for i in t.values():
    if i != 2:
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")
Buggy code:
s = input()
t = [s[0], s[1], s[2], s[3]]
u = list(set(t))
v = len(u)
w = s.count(u[0])
x = s.count(u[1])
if v != 2:
    print("No")
else:
    w = s.count(u[0])
    x = s.count(u[1])
    if w == 2 and x ==2:
	print("Yes")
    else:
	print("No")

Fixed code:
s = input()
t = [s[0], s[1], s[2], s[3]]
u = list(set(t))
v = len(u)
if v != 2:
    print("No")
else:
    w = s.count(u[0])
    x = s.count(u[1])
    if w == 2 and x ==2:
      print("Yes")
    else:
      print("No")
Buggy code:
S = str(input())

if S[0] == S[1] and S[2] == S[3]:
  print('Yes')
else:
  print('No')

Fixed code:
S = str(input())
S = sorted(S)

if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
  print('Yes')
else:
  print('No')
Buggy code:
S = input()
if (S[0] == S[1] and S[0] !==S[2] and S[2] == S[3])or
(S[0] != S[1] and S[0] ==S[2] and S[1] == S[3])or
(S[0] != S[1] and S[1] == S[2] and S[0] == S[3]):
  print("Yes")
else:
  print("No")
  

Fixed code:
S = input()
if ((S[0] == S[1]) and (S[0] !=S[2]) and (S[2] == S[3]))or((S[0] != S[1]) and (S[0] ==S[2]) and (S[1] == S[3]))or((S[0] != S[1]) and (S[1] == S[2]) and (S[0] == S[3])):
  print("Yes")
else:
  print("No")
Buggy code:
import numpy as np
S = input()
S_ = list(set(S))
S = np.array(list(S))
S_ = np.array(S_)
print(S_)
ans = 'Yes'
if len(S_)!=2:
    ans = 'No'
elif sum(S==S_[0])!=2:
    ans = 'No'

print(ans)

Fixed code:
import numpy as np
S = input()
S_ = list(set(S))
S = np.array(list(S))
S_ = np.array(S_)
ans = 'Yes'
if len(S_)!=2:
    ans = 'No'
elif sum(S==S_[0])!=2:
    ans = 'No'

print(ans)
Buggy code:
s = input()
l = set(s)
if len(l) == 2 and l.count(s[0]) == 2:
    print('Yes')
else:
    print('No')

Fixed code:
s = input()
l = set(s)
if len(l) == 2 and s.count(s[0]) == 2:
    print('Yes')
else:
    print('No')
Buggy code:
S=input()
list=[S[0],S[1],S[2],S[3]]
if list.count(S[0])==list.count(S[1])==list.count(S[2])==list.count(S[3]):
  print('Yes')
else:
  print('No')

Fixed code:
S=input()
list=[S[0],S[1],S[2],S[3]]
if list.count(S[0])==list.count(S[1])==list.count(S[2])==list.count(S[3])==2:
  print('Yes')
else:
  print('No')
Buggy code:
s = sorted(list(input()))
if len(set(s)) == 2 and s[1] == s[2]:
    print('Yes')
else:
    print('No')

Fixed code:
s = sorted(list(input()))
if len(set(s)) == 2 and s[1] != s[2]:
    print('Yes')
else:
    print('No')
Buggy code:
S = list(input())
A = sorted(S)
if A[0] == A[1] ! A[2] == A[3]:
  print("Yes")
else:
  print("No")

Fixed code:
S = list(input())
A = sorted(S)
if A[0] == A[1] != A[2] == A[3]:
  print("Yes")
else:
  print("No")
Buggy code:
s=input()
set_s=set(list(s))
list_s=list(s)
list_s.sort()
print(set_s)
print(list_s)
if len(set_s)==2 and list_s[0]==list_s[1] and list_s[2]==list_s[3]:
    print('Yes')
else:
    print('No')

Fixed code:
s=input()
set_s=set(list(s))
list_s=list(s)
list_s.sort()
if len(set_s)==2 and list_s[0]==list_s[1] and list_s[2]==list_s[3]:
    print('Yes')
else:
    print('No')
Buggy code:
s = input()
s_list = [0] * 4
s_list = sorted([c for c in s])

if s_list[0] == s_list[1] and  s_list[2] != s_list[2] and  s_list[2] == s_list[3]:
  print('Yes')
  exit()
print('No')

Fixed code:
s = input()
s_list = [0] * 4
s_list = sorted([c for c in s])

if s_list[0] == s_list[1] and  s_list[1] != s_list[2] and  s_list[2] == s_list[3]:
  print('Yes')
  exit()
print('No')
Buggy code:
import sys
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
s.replace(a,"")

if s[0] != s[1]:
  print("No")
else:
  print("Yes")


Fixed code:
import sys
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
t = s.replace(a,"")

if t[0] != t[1]:
  print("No")
else:
  print("Yes")
Buggy code:
a = input()
a = a.replace(c[0], "")
a = a.replace(c[0], "")
if len(a) == 0:
    print("Yes")
else:
    print("No")
    

Fixed code:
a = input()
a = a.replace(a[0], "")
if len(a) == 0:
    print("No")
    exit()
a = a.replace(a[0], "")
if len(a) == 0:
    print("Yes")
else:
    print("No")
Buggy code:
S = str(input())
S1 = set(S)
if len(S1) == 2 and S.count(S1[0]) == 2 and S.count(S1[1]):
    print("Yes")
else:
    print("No")

Fixed code:
S = str(input())
S1 = list(set(S))
if len(S1) == 2 and S.count(S1[0]) == 2 and S.count(S1[1]) == 2:
    print("Yes")
else:
    print("No")
Buggy code:
s = list(str(input()))
sorted(s)
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print('Yes')
else:
    print('No')

Fixed code:
s = list(str(input()))
s = sorted(s)
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print('Yes')
else:
    print('No')
Buggy code:
s = input()
d = {}
for e in s:
  if e in d:
    d[e] += 1
  else:
    d[e] = 1

if len(d) == 2 and set(d.values()) = {2}:
  print("Yes")
else:
  print("No")

Fixed code:
s = input()
d = {}
for e in s:
  if e in d:
    d[e] += 1
  else:
    d[e] = 1

if len(d) == 2 and set(d.values()) == {2}:
  print("Yes")
else:
  print("No")
Buggy code:
s = input()
s.sort()
if s[0] == s[1] and s[2] == s[3]:
    print('Yes')
else:
    print('No')


Fixed code:
s=list(input())
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[1] != s[2]:
    print("Yes")
else:
    print("No")
Buggy code:
s=list(input())
a=len(set(s)
if a==2:
	b=len([t for t in s if t==s[0]])
	if b==2:
      	print('Yes')
    else:
      	print('No')
else:
    print('No')

Fixed code:
s=list(input())
a=len(set(s))
ans='No'
if a==2:
  b=len([t for t in s if t==s[0]])
  if b==2:
    ans='Yes'
print(ans)
Buggy code:
s=input()
a=s[0]
b=0
ac=1
bc=1
for i in range(1,4):
    if s[i]!=a:
        if s[i]!=b:
            if b==0:
                b=s[i]
            else:
                break
        else:
            bc-=1
    else:
        ac-=1
print(ac,bc)
if ac==0 and bc==0:
    print("Yes")
else:
    print("No")



Fixed code:
s=input()
a=s[0]
b=0
ac=1
bc=1
for i in range(1,4):
    if s[i]!=a:
        if s[i]!=b:
            if b==0:
                b=s[i]
            else:
                break
        else:
            bc-=1
    else:
        ac-=1
if ac==0 and bc==0:
    print("Yes")
else:
    print("No")
Buggy code:
ss=input().strip()
d={}
for s in ss:
  d[s]=d.get(s,0)+1

flg=False
for s in ss:
  if d[s]!=2:
    flg=True
print("Yes" if flg else "No")

Fixed code:
ss=input().strip()
d={}
for s in ss:
  d[s]=d.get(s,0)+1

flg=False
for s in ss:
  if d[s]!=2:
    flg=True
print("No" if flg else "Yes")
Buggy code:
# -*- coding: utf-8 -*-

s = input()
cnt = {l:0 for l in set(s)}
if len(cnt) != 2:
    print('No')

for l in s:
    cnt[l] += 1
    if cnt[l] > 2:
        print('No')

print('Yes')


Fixed code:
# -*- coding: utf-8 -*-

s = input()
cnt = {l:0 for l in set(s)}
if len(cnt) != 2:
    print('No')
    exit(0)

for l in s:
    cnt[l] += 1
    if cnt[l] > 2:
        print('No')
        exit(0)

print('Yes')
Buggy code:
word=input()
word=sorted(word)
print(word)
if word[0]==word[1] and word[2]==word[3] and word[0]!=word[2]:
    print('Yes')
else:
    print('No')


Fixed code:
word=input()
word=sorted(word)
if word[0]!=word[2] and word[1]!=word[3]:
    if word[0]==word[1] and word[2]==word[3]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy code:
#ABC132 A

S = str(input())
T = [S[0],S[1],S[2],S[3]]
T.sort()
if T[0] == T[1] and T[2] == T[3] and T[1] != T[2]
    print("Yes")
else:
    print("No")

Fixed code:
#ABC132 A

S = str(input())
T = [S[0],S[1],S[2],S[3]]
T.sort()
if T[0] == T[1] and T[2] == T[3] and T[1] != T[2]:
    print("Yes")
else:
    print("No")
Buggy code:
s = input()

letters = []
for i in range(n):
  if not s[0] in letters:
    letters.append(s[0])
  
if len(letters)==2 and letters.count(s[0])==2:
  print('Yes')
else:
  print('No')

Fixed code:
s = input()

letters = []
for i in range(4):
  if not s[i] in letters:
    letters.append(s[i])
  
if len(letters)==2 and s.count(s[0])==2:
  print('Yes')
else:
  print('No')
Buggy code:
S = input()
S1 = []
for i in S:
  if i not in S1:
    S1.append(i)
if len(S1) == 2:
  print('Yes')
else:
  prin('No')

Fixed code:
S = input()
S1 = []
for i in S:
  if i not in S1:
    S1.append(i)
if len(S1) == 2:
  print('Yes')
else:
  print('No')
Buggy code:
S = list(input())
S.sort()
print(S)
if S[0]==S[1] and S[2]==S[3] and S[1]!=S[2]:
    print("Yes")
else: print("No")

Fixed code:
S = input()
S=list(S)
S.sort()

if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
    print("Yes")
else:
    print("No")