qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = input()

cnt = 0
if n.count(n[0]) == 2:
  cnt += 1
if n.count(n[1]) == 2:
  cnt += 1
if n.count(n[2]) == 2:
  cnt += 1
if n.count(n[3]) == 2:
  cnt += 1

if cnt == 2:
  print('Yes')
else:
  print('No')
 

Fixed code:
n = input()

cnt = 0

if n.count(n[0]) == 2:
  cnt += 1
if n.count(n[1]) == 2:
  cnt += 1
if n.count(n[2]) == 2:
  cnt += 1
if n.count(n[3]) == 2:
  cnt += 1

if cnt == 4:
  print('Yes')
else:
  print('No')
Buggy code:
S=input()
count=0
first=False
OK=False
memo=S[0]
for i in range(4):    
    if S[i]==S[0]:
        count+=1
    elif (S[i]!=S[0] and first==False):
        memo=S[i]
        first=True
        print(memo)

    elif (S[i]!=S[0] and first==True):
        if S[i]==memo:
            OK=True

print(count)
print(memo)

if (count==2 and OK==True):
    print("Yes")
else:
    print("NO")

Fixed code:
S=input()
count=0
first=False
OK=False
memo=S[0]
for i in range(4):    
    if S[i]==S[0]:
        count+=1
    elif (S[i]!=S[0] and first==False):
        memo=S[i]
        first=True
    elif (S[i]!=S[0] and first==True):
        if S[i]==memo:
            OK=True


if (count==2 and OK==True):
    print("Yes")
else:
    print("No")
Buggy code:
s = str(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')

Fixed code:
s = str(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 = input()

appearence = {}

for char in S:
    print(char)
    if char not in appearence:
        appearence[char] = 1
    else:
        appearence[char] += 1

if len(appearence) == 2 and all(2 == value for value in appearence.values()):
    print('Yes')
else:
    print('No')


Fixed code:
S = input()

appearence = {}

for char in S:
    if char not in appearence:
        appearence[char] = 1
    else:
        appearence[char] += 1

if len(appearence) == 2 and all(2 == value for value in appearence.values()):
    print('Yes')
else:
    print('No')
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[1] != S[2]):
  print('Yes')
else:
  print('No')
Buggy code:
S = input()
S=str(S)

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

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

if S[0]==S[1]:
  if S[2]==S[3]:
    if S[0] != S[2]:
      print('Yes')
    else:
      print('No')
  else:
  	print('No')
elif S[0]==S[2]:
  if S[1]==S[3]:
    if S[0] != S[1]:
      print('Yes')
    else:
      print('No')
  else:
  	print('No')
elif S[0]==S[3]:
  if S[1]==S[2]:
    if S[0] != S[1]:
      print('Yes')
    else:
      print('No')
  else:
  	print('No')
else:
	print('No')
Buggy code:
ss = input()
set_ss = set(ss)
if len(set_ss) != 2 :
  print("No")
else:
	for s in set(ss):
    	if ss.count(s) != 2:
          print("No")
          break
    else:
    	print("Yes") 

Fixed code:
ss = input()
set_ss = set(ss)
if len(set_ss) != 2 :
  print("No")
else:
  for s in set(ss):
    if ss.count(s) != 2:
      print("No")
      break
  else:
    print("Yes")
Buggy code:
print('Yes' if len(set(input()))==2 and S.count(S[0])==2 else 'No')

Fixed code:
S = input()
print('Yes' if len(set(S))==2 and S.count(S[0])==2 else 'No')
Buggy code:
a=input()
ret = True
for s in a:
	sum = 0
	for t in _in:
		if s==t:
			sum += 1
	if sum != 2:
		ret = False
if ret:
	print("Yes")
else:
	print ("No")

Fixed code:
a=input()
ret = True
for s in a:
	sum = 0
	for t in a:
		if s==t:
			sum += 1
	if sum != 2:
		ret = False
if ret:
	print("Yes")
else:
	print ("No")
Buggy code:
s = input()
t = list(s)[0]
s = s.replace(t, '', 2)
if(s != t):
    s = s.replace(t, '', 2)
if(len(s) == 0):
    print("Yes")
else:
    print("No")


Fixed code:
s = input()
t = list(s)[0]
s = s.replace(t, '', 2)
if(list(s)[0] != t):
    s = s.replace(list(s)[0], '', 2)
if(len(s) == 0):
    print("Yes")
else:
    print("No")
Buggy code:
S = input()

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

elif S[1]==S[2] and  S[0]==S[3] and S[0]!=S[1]:
        print('Yes')
        
elif S[1]==S[3] and  S[0]==S[2] and S[0]!=S[1]:
        print('Yes')

else :
    print('No')


Fixed code:
S = input()
 
if S[1]==S[2]==S[3]==S[0]:
        print('No')
        
elif S[0]==S[1] and S[2]==S[3]:
        print('Yes')
 
elif S[1]==S[2] and  S[0]==S[3]:
        print('Yes')
        
elif S[1]==S[3] and  S[0]==S[2]:
        print('Yes')
 
else :
    print('No')
Buggy code:
S = 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[2]):
  print("Yes")
else:
  print("No")
  

Fixed code:
S = 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[2]):
  print("Yes")
else:
  print("No")
Buggy code:
S = input()
s = list(set(S))
print("Yes" if len(set(S)) == 2 and s.count(s[0]) == 2 and s.count(s[1]) == 2 else "No")

Fixed code:
S = input()
s = list(set(S))
print("Yes" if len(set(S)) == 2 and S.count(s[0]) == 2 and S.count(s[1]) == 2 else "No")
Buggy code:
S = input()
print("Yes" if sum([2==S.count(ch) for ch in S]) else "No")


Fixed code:
S = input()
print("Yes" if sum([2==S.count(ch) for ch in S])==4 else "No")
Buggy code:
s = list(input()).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:
S = list(input())
S1 = sorted(S)

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


Fixed code:
S = list(input())
S1 = sorted(S)

if S1[0] == S1[1] and S1[2] == S1[3] and S1[1] != S1[2]:
  print("Yes")
else:
  print("No")
Buggy code:
s=input()
ans="No"
for i in range(4):
    if s.count(s[i])==2:
        ans="Yes"
print(ans)

Fixed code:
s=input()
ans="Yes"
for i in range(4):
    if s.count(s[i])!=2:
        ans="No"
print(ans)
Buggy code:
def main():
  s = input()
  if len(set(s)) == 2:
    a = 0
    for i in range(1, 3):
      a += 1 if s[0] == s[i] else 0
    print('Yes' if a == 1 else 'No')
  else:
    print('No')


if __name__ == '__main__':
  main()

Fixed code:
def main():
  s = input()
  if len(set(s)) == 2:
    a = 0
    for i in range(1, 4):
      a += 1 if s[0] == s[i] else 0
    print('Yes' if a == 1 else 'No')
  else:
    print('No')


if __name__ == '__main__':
  main()
Buggy code:
a=list(input())
b=set(a)
count=0
for i in range(4):
  if a[0]==a[i]:
    count+=1
if len(b)==0 and (count==2):
  print('Yes')
else:
  print('No')



Fixed code:
a=list(input())
b=set(a)
count=0
for i in range(4):
  if a[0]==a[i]:
    count+=1
if len(b)==2 and (count==2):
  print('Yes')
else:
  print('No')
Buggy code:
s = list(input())
t = set[s]
if len(t) == 2 and s.count(t[0]) == 2 :
    print("Yes")
else :
    print("No")


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

a1 = S[0]
a2 = "NUM"

if S[1] == a1:
    list1[0]=2
else:
    a2 = S[1]

if S[2]==a1:
    list1[0]=2
else:
    if S[1]==a1:
        a2 =S[2]
    else:
        if S[2]==a2:
            list1[1]=2
        else:
            pass

if S[3]==a1:
    list1[0]=2
else:
    if S[2]==a1:
        a2 = S[3]
    else:
        if S[3]==a2:
            list1[1]=2
        else:
            pass

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

Fixed code:
list1 = [0,0]
S=input()

a1 = S[0]
a2 = "NUM"

if S[1] == a1:
    list1[0]=2
else:
    a2 = S[1]

if S[2]==a1:
    list1[0]=2
else:
    if S[1]==a1:
        a2 =S[2]
    else:
        if S[2]==a2:
            list1[1]=2
        else:
            pass

if S[3]==a1:
    list1[0]=2
else:
    if S[2]==a1 and S[1] == a1:
        a2 = S[3]
    else:
        if S[3]==a2:
            list1[1]=2
        else:
            pass
        
if list1[1]==2 and list1[0]==2:
    print("Yes")
else:
    print("No")
Buggy code:
s = input()
if 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]) or (s[0]==s[2] and s[1]==s[3]) or (s[0]==s[3] and s[1]==s[2]):
    print("Yes")
else:
    print("No")
Buggy code:
S = input()
from collections import Counter
c = Counter(S)

if 2 in c.values() or len(c.keys()) == 2:
    print('Yes')
else:
    print('No') 

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

if 2 in c.values() and len(c.keys()) == 2:
    print('Yes')
else:
    print('No')
Buggy code:
s = input()
print('Yes' if len(set(s)) == 2 and s.count[s[0]] == 2 else 'No')

Fixed code:
s = input()
print('Yes' if len(set(s)) == 2 and s.count(s[0]) == 2 else 'No')
Buggy code:
S=str(input())
a=0
for i in S:
  if S.count(i)==2:
    a+=2
    
print('Yes' if a==4 else 'No')

Fixed code:
S=str(input())
a=0
for i in S:
  if S.count(i)==2:
    a+=1
    
print('Yes' if a==4 else 'No')
Buggy code:
def main():
    S = input()
    if S[0] == S[1] and S[2] == S[3]:
        ans = "Yes"
    elif S[0] == S[2] and S[1] == S[3]:
        ans = "Yes"
    elif S[0] == S[3] and S[1] == S[2]:
        ans = "Yes"
    else:
    else:
        ans = "No"
    print(ans)


if __name__ == '__main__':
    main()


Fixed code:
def main():
    S = input()
    if S[0] == S[1] == S[2] == S[3]:
        ans = "No"
    elif S[0] == S[1] and S[2] == S[3]:
        ans = "Yes"
    elif S[0] == S[2] and S[1] == S[3]:
        ans = "Yes"
    elif S[0] == S[3] and S[1] == S[2]:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)


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

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


Fixed code:
s = 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:
lis = list(i for i in input())
if lis.count(lis[0])==lis.count(lis[1])==lis.count(lis[2])==lis.count(lis[3]):
    print("Yes")
else:
    print("No")

Fixed code:
lis = list(i for i in input())
if lis.count(lis[0])==lis.count(lis[1])==lis.count(lis[2])==lis.count(lis[3])==2:
    print("Yes")
else:
    print("No")
Buggy code:
four = input()

four = sorted(four)
if four[1] = four[2] and four[3] = four[4] and four[2] != four[3]:
	print ("Yes")
else:
	print("No")

Fixed code:
four = input()
 
four = sorted(four)
if four[0] == four[1] and four[2] == four[3] and four[1] != four[2]:
	print ("Yes")
else:
	print("No")
Buggy code:
S = list(input())
 
s = 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(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 = list(input())

cnt = [1,0,0,0]


if(S[1] == S[0]):
    cnt[0] += 1
else:
    cnt[1] += 1

if(S[2] == S[0]):
    cnt[0] += 1
elif(S[2] == S[1]):
    cnt[1] += 1
else:
    cnt[2] += 1

if(S[3] == S[0]):
    cnt[0] += 1
elif(S[3] == S[1]):
    cnt[1] += 1
elif(S[3] == S[2]):
    cnt[2] += 1
else:
    cnt[3] += 1

if(cnt == [2,2,0,0]):
    print("Yes")
else:
    print("No")


Fixed code:
S = list(input())

cnt = [1,0,0,0]

if(S[1] == S[0]):
    cnt[0] += 1
else:
    cnt[1] += 1

if(S[2] == S[0]):
    cnt[0] += 1
elif(S[2] == S[1]):
    cnt[1] += 1
else:
    cnt[2] += 1

if(S[3] == S[0]):
    cnt[0] += 1
elif(S[3] == S[1]):
    cnt[1] += 1
elif(S[3] == S[2]):
    cnt[2] += 1
else:
    cnt[3] += 1

if(cnt == [2,2,0,0] or cnt == [2,0,2,0]):
    print("Yes")
else:
    print("No")
Buggy code:
d={}
A = input()
for i in range(len(A)):
    if d.get(A[i],None)==None:
        d[A[i]]=1
    else:
        d[A[i]]+=1

if(max(d.values())==2):
    print("Yes")
else:print("No")

Fixed code:
d={}
A = input()
for i in range(len(A)):
    if d.get(A[i],None)==None:
        d[A[i]]=1
    else:
        d[A[i]]+=1

if(max(d.values())==2 & min(d.values())==2):
    print("Yes")
else:print("No")
Buggy code:
def code_for_A(S, test=None):

    if not test:
        S = input()

    condition = 0
    for s in S:
        condition += S.count(s) != 2

    if condition:
        answer = 'No'
    else:
        answer = 'Yes'

    print(answer)

code_for_A(,1)

Fixed code:
def code_for_A(S, test=None):

    if not test:
        S = input()

    condition = 0
    for s in S:
        condition += S.count(s) != 2

    if condition:
        answer = 'No'
    else:
        answer = 'Yes'

    print(answer)

code_for_A(None, 0)
Buggy code:
s = list(input())
s.sort()

if s[0]==s[1] and s[2]==s[3] ans s[0]!=s[2]:
    ans = "Yes"
else:
    ans = "No"

print(ans)

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

if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]:
    ans = "Yes"
else:
    ans = "No"

print(ans)
Buggy code:
#import math.sqrt as sqrt

#S = list(map(int, input().split()))
#B = list(map(int, input().split()))

S = list(input())
count = [0, 0, 0]

for i in range(len(S)-1):
    for j in range(i+1, len(S)):
        if S[i] == S[j]:
            count[i] += 1

       # print(S[j]+" "+S[i])

print(count)

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


Fixed code:
#import math.sqrt as sqrt

#S = list(map(int, input().split()))
#B = list(map(int, input().split()))

S = list(input())
count = [0, 0, 0]

for i in range(len(S)-1):
    for j in range(i+1, len(S)):
        if S[i] == S[j]:
            count[i] += 1

       # print(S[j]+" "+S[i])

#print(count)

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

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

con = True
for i in ss:
  con = False if ss.count(i) != 2 else True
if con:
  print("Yes")
else:
  print("No")
    

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

con = True
for i in ss:
  if ss.count(i) != 2:
    con = False
if con:
  print("Yes")
else:
  print("No")
Buggy code:
s = input()
print(set(s))
if len(set(list(s))) == 2:
    print("Yes")
else:
    print("No")


Fixed code:
s = input()
if len(set(list(s))) == 2:
    print("Yes")
else:
    print("No")
Buggy code:
s = list(input())
count = 0
print(s)
if s[0]==s[1]:
	count += 1
if s[0]==s[2]:
	count += 1
if s[0]==s[3]:
	count += 1
if s[1]==s[2]:
	count += 1
if s[1]==s[3]:
	count += 1
if s[2]==s[3]:
	count += 1
print(count)
print("Yes" if len(set(s))==2 and count==2 else "No")


Fixed code:
s = list(input())
count = 0
if s[0]==s[1]:
	count += 1
if s[0]==s[2]:
	count += 1
if s[0]==s[3]:
	count += 1
if s[1]==s[2]:
	count += 1
if s[1]==s[3]:
	count += 1
if s[2]==s[3]:
	count += 1
print("Yes" if len(set(s))==2 and count==2 else "No")
Buggy code:
S = input()
mozi = dict()
for i in range(4):
  try:
    mozi(S[i]) += 1
  except:
    mozi(S[i]) = 1
    
num = 0
for i in mozi:
  num += 1
  if S[i] != 2:
    print("No")
    exit()

if num == 2:
  print("Yes")
else:
  print("No")
    


Fixed code:
S = input()
mozi = dict()
for i in range(4):
	mozi[S[i]] = 0

for i in range(4):
    mozi[S[i]] += 1

num = 0
for i in mozi:
  num += 1
  if mozi[i] != 2:
    print("No")
    exit()
 
if num == 2:
  print("Yes")
else:
  print("No")
Buggy code:
a = list(input())
if len(set(a)) == 2:
  count = 0
  for r in set(a):
    if r.count(a) == 2:
      count += 1
  if count == 2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed code:
a = list(input())
if len(set(a)) == 2:
  count = 0
  for r in set(a):
    if a.count(r) == 2:
      count += 1
  if count == 2:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy code:
s=input()
import colletions
s=dict(collections.Counter(s))
if len(s)==2:
  flag=True
  for k in s.values():
    if k!=2:
      flag=False
  if flag:
    print("Yes")
  else:
    print("No")
else:
  print("No")
  

Fixed code:
s=input()
import collections
s=dict(collections.Counter(s))
if len(s)==2:
  flag=True
  for k in s.values():
    if k!=2:
      flag=False
  if flag:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy code:
import itertools
import sys

def hantei(s):
  i = 0
  for s1, s2 in itertools.combinations(s, 2):
    if s1 == s2:
      i += 1
    print(s1, s2)
  
  return 'Yes' if i == 2 else 'No'


if __name__ == '__main__':
  args = sys.stdin
  
  for arg in args:
    print(hantei(str(arg)))


Fixed code:
import itertools
import sys

def hantei(s):
  hantei = s.isupper()
  
  if hantei:
    i = 0
    for s1, s2 in itertools.combinations(s, 2):
      if s1 == s2:
        i += 1
    hantei = 'Yes' if i == 2 else 'No'
  else:
    hantei = 'No'
    
  return hantei


if __name__ == '__main__':
  args = sys.stdin
  
  for arg in args:
    print(hantei(str(arg)))
Buggy code:
A = list(input())
B = set(A)
if len(B) == 1 and A.count(A[0]) == 2:
  print("Yes")
else:
  print("No")


Fixed code:
A = list(input())
B = set(A)
if len(B) == 2 and A.count(A[0]) == 2:
  print("Yes")
else:
  print("No")
Buggy code:
from collections import defaultdict
S = input()

d = defaultdict(int)

for i in range(len(S)):
    d[S[i]] += 1
f = 0
for i in range(len(S)):
    if d[S[i]] != 2:
        f = 1

if f == 0:
    print("Yes")

Fixed code:
from collections import defaultdict
S = input()

d = defaultdict(int)

for i in range(len(S)):
    d[S[i]] += 1
f = 0
for i in range(len(S)):
    if d[S[i]] != 2:
        f = 1

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

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

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

Fixed code:
S=input()

if S[0] == S[1] != S[2] == S[3] or S[0] == S[2] != S[1] == S[3] or S[0] == S[3] != S[1] == S[2]:
  print('Yes')
else:
  print('No')
Buggy code:
s = input()
list = []
for l in s:
	if l not in list:
		list.append(l)
if len(list) == 2:
	if s.count(list[0]) == 2:
		print('Yes')
	else:
		print('no')
else:
	print('no')

Fixed code:
s = input()
list = []
for l in s:
	if l not in list:
		list.append(l)
if len(list) == 2:
	if s.count(list[0]) == 2:
		print('Yes')
	else:
		print('No')
else:
	print('No')
Buggy code:
S=sorted(input())
if S[0==S[1] and S[2]==S[3] and S[0]!=S[2]]:
    print('Yes')
else:
    print('No')

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

Fixed code:
s = sorted(list(input()))
if s[0] == s[1] == s[2] == s[3]:
    print('No')
elif s[0] == s[1] and s[2] == s[3]:
    print('Yes')
else:
    print('No')
Buggy code:
def func():
    input_line = list(str(input('Put any literal: ')))
    flag = 0
    for i in range(len(input_line)):
        for j in range(i+1,len(input_line)):
            if input_line[i] == input_line[j]:
                flag += 1
    if flag == 2:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    func()
                

Fixed code:
def func():
    input_line = list(str(input('')))
    flag = 0
    for i in range(len(input_line)):
        for j in range(i+1,len(input_line)):
            if input_line[i] == input_line[j]:
                flag += 1
    if flag == 2:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    func()
Buggy code:
s = input()
se = list(set(s))
if len(se) != 2:
    print('No')
elif s.count(se[0]) == 2:
    print('No')
else:
    print('Yes')

Fixed code:
s = input()
se = list(set(s))
if len(se) != 2:
    print('No')
elif s.count(se[0]) != 2:
    print('No')
else:
    print('Yes')
Buggy code:
a =input()

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

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


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

Fixed code:
if len(set(input())) == 2:
  print('Yes')
else:
  print('No')
Buggy code:
s = input()

orgin = set(list(s))

if len(orgin) > 2:
    print("No")
    exit()

a=0
b=0
for i in s:
    if i == origin[0]: a+=1
    elif i == origin[1]: b+=1

if a==2:
    print("Yes")
else:
    print("No")

Fixed code:
s = input()

origin = list(set(list(s)))

if len(origin) > 2:
    print("No")
    exit()
a=0
b=0
for i in s:
    if i == origin[0]: a+=1
    elif i == origin[1]: b+=1

if a==2:
    print("Yes")
else:
    print("No")
Buggy code:
s = list(input())
s.sort()

if len(set(s)) == 2 && s[0] == s[1] && s[2] == s[3]:
    print("Yes")
else:
    print("No")

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

if len(set(s)) == 2 and s[0] == s[1] and s[2] == s[3]:
    print("Yes")
else:
    print("No")
Buggy code:
s=input()
t=set(s)
if len(t)==2:
  cnt1=0
  cnt2=0
  for i in s:
    if i==t[0]:
      cnt1+=1
      
    elif i==t[1]:
      cnt2+=1
      
  if cnt1==2 and cnt2==2:
    print('Yes')
    exit()
    
print('No')
    
  

Fixed code:
s=input()
t=list(set(s))
if len(t)==2:
  cnt1=0
  cnt2=0
  for i in s:
    if i==t[0]:
      cnt1+=1
      
    elif i==t[1]:
      cnt2+=1
      
  if cnt1==2 and cnt2==2:
    print('Yes')
    exit()
    
print('No')
Buggy code:
S=input()
S.split()
if S[0]==S[1]:
    if S[2]==S[3]:
        if not S[1]==S[3]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif S[0]==S[2]:
    if S[1]==S[3]:
        if not S[1]==S[2]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

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


Fixed code:
S=input()
S.split()
if S[0]==S[1]:
    if S[2]==S[3]:
        if not S[1]==S[3]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif S[0]==S[2]:
    if S[1]==S[3]:
        if not S[1]==S[2]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

elif S[0]==S[3]:
    if S[2]==S[1]:
        if not S[0]==S[2]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")
Buggy code:
import collections as c
s=input()
a=c.Counter(s)
if a.values()==[2,2]:
  print('Yes')
else:
  print('No')

Fixed code:
import collections as c
s=input()
a=c.Counter(s)
if str(a.values())=='dict_values([2, 2])':
  print('Yes')
else:
  print('No')
Buggy code:
list1 = list(input())
#list1.sort()
if (list1[0]==list1[1] and list1[2]==list1[3] and list1[2]!=list1[1]):
    print("Yes")
else:
    print("No")

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