qyliang/CodeNanoFix huggingface dataset:
Buggy code:
S = list(input())
S = sorted(S)

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

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

if len(S) > 0:
    S = S.replace(S[0],"")
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Fixed code:
S = input()
S = S.replace(S[0],"")
if len(S) > 0:
    S = S.replace(S[0],"")
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy code:
S = list(str(input()))

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

Fixed code:
S = list(str(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 = input()
S_list = list(S)
print(S_list)
df = "Yes"
for i in range(0, 3):
    if S_list.count(S_list[i]) != 2:
        df = "No"
print(df)

Fixed code:
S = input()
S_list = list(S)
df = "Yes"
for i in range(0, 3):
    if S_list.count(S_list[i]) != 2:
        df = "No"
print(df)
Buggy code:
S=input()
from collections import Counter
c = Counter(list(S))
cnt = 0
for char in list("abcdefghijklmnopqrstuvwxyz"):
    if c[char] == 2:
        cnt += 1
if cnt == 2:
    print("Yes")
else:
    print("No")

Fixed code:
S=input()
from collections import Counter
c = Counter(list(S))
cnt = 0
for char in list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
    if c[char] == 2:
        cnt += 1
if cnt == 2:
    print("Yes")
else:
    print("No")
Buggy code:
w = input()
a,b,c,d = w[0],w[1],w[2],w[3]
if a == b and b != c and c == d:
    print('Yes')
elif a == b and b != c and b == d:
    print('Yes')
elif a == b and b == c and a != b:
    print('Yes')
else:
  print('No')

Fixed code:
w = input()
a,b,c,d = w[0],w[1],w[2],w[3]
if a == b and b != c and c == d:
    print('Yes')
elif a == c and b != c and b == d:
    print('Yes')
elif a == d and b == c and a != b:
    print('Yes')
else:
  print('No')
Buggy code:
S = input()

if (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')


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[1]):
	print('Yes')
else:
	print('No')
Buggy code:
S=input()

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


Fixed code:
S=input()

if S[0]==S[1] and S[2]==S[3]:
    if S[1]==S[2]:
        print("No")
    else:
        print("Yes")
elif S[0]==S[2] and S[1]==S[3]:
    if S[1]==S[2]:
        print("No")
    else:
        print("Yes")
elif S[0]==S[3] and S[1]==S[2]:
    if S[0]==S[2]:
        print("No")
    else:
        print("Yes")   
    
else:
    print("No")
Buggy code:
s = str(input())
s0 = s[0]
print(s[2:4])
if s0 == s[1]:
    if s[2] == s[3] and s[2] != s0:
        print('Yes')
    else:
        print('No')
else:
    s1 = s[1]
    if s1 in s[2:4] and s0 in s[2:4]:
        print('Yes')
    else:
        print('No')


Fixed code:
s = str(input())
s0 = s[0]
if s0 == s[1]:
    if s[2] == s[3] and s[2] != s0:
        print('Yes')
    else:
        print('No')
else:
    s1 = s[1]
    if s1 in s[2:4] and s0 in s[2:4]:
        print('Yes')
    else:
        print('No')
Buggy code:
s = input()

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


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

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


Fixed code:
s = sorted(input())


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

s = input()
c = collections.Counter(s)

if [2,2] == [x for x in c.values()]:
  print('Yes')
else:
  print('No')

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

if [2,2] == [x for x in c.values()]:
  print('Yes')
else:
  print('No')
Buggy code:
S = str(input())
count=0
for i in range(len(S)-1):
  for j in range(i,len(S)):
    if S[i] == S[j]:
      count+=1
if count==2:
  print("Yes")
else:
  print("No")

Fixed code:
S = str(input())
count=0
for i in range(len(S)-1):
  for j in range(i+1,len(S)):
    if S[i] == S[j]:
      count+=1
if count==2:
  print("Yes")
else:
  print("No")
Buggy code:
y = sorted(list(input()))
print(y)
if (y[0] == y[1]) and(y[2]== y[3])and(y[0]!=y[2]):
    print('Yes')
else:
    print('No')

Fixed code:
y = sorted(list(input()))

if (y[0] == y[1]) and(y[2]== y[3])and(y[0]!=y[2]):
    print('Yes')
else:
    print('No')
Buggy code:
S=input()
cnt=[0 for _ in range(26)]
for c in S:
  cnt[ord(c)-ord('A')]+=1

  ans="Yes"
for x in cnt:
  if(x==0 or x==2):
    continue;
  else:
    ans="No"

print("Yes")

Fixed code:
S=input()
cnt=[0 for _ in range(26)]
for c in S:
  cnt[ord(c)-ord('A')]+=1

  ans="Yes"
for x in cnt:
  if(x==0 or x==2):
    continue;
  else:
    ans="No"

print(ans)
Buggy code:

input = input().split()
inputList = list(input)
# a = int(input[0])
# b = int(input[1])
# c = int(input[2])

inputList.sort()

flg = 1
for i in range(0, len(inputList)-1, 2):
    if inputList[i] != inputList[i + 1]:
        flg = 0
        break

if flg == 0:
    print("No")
else:
    print("Yes")


Fixed code:

input = input().split()
inputList = list(input[0])
# a = int(input[0])
# b = int(input[1])
# c = int(input[2])

inputList.sort()

flg = 1
for i in range(0, len(inputList)-1, 2):
    if inputList[i] != inputList[i + 1]:
        flg = 0
        break
    if inputList[1] == inputList[2]:
        flg = 0
        break

if flg == 0:
    print("No")
else:
    print("Yes")
Buggy code:
s = input()

s = sorted(s)

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


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] 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[2] ==S[1]:
  print("Yes")
else:
  prnt("No")

Fixed code:
S = input()
if S[0] == S[1] and S[2] == S[3] and S[0] == S[2]:
    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[2] == S[1]:
    print("Yes")
else:
    print("No")
Buggy code:
x = [i for i in input()]
x.sort
if x[0] == x[1] and x[2] == x[3] and x[1] != x[2]:
  print("Yes")
else:
  print("No")
  

Fixed code:
x = [i for i in input()]
x.sort()
if x[0] == x[1] and x[2] == x[3] and x[1] != x[2]:
  print("Yes")
else:
  print("No")
Buggy code:
S = list(input())
if len(S) == 4 and (S.count(S[1])) == 2  and len(set(s))==2:
    print('Yes')
else:
    print('No')


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

Fixed code:
s = input()
for i in s:
  if s.count(i) != 2:
    print("No")
    exit()
print("Yes")
Buggy code:
l=[i for i in input()]

ans='No'

con=len(unique(l))
if (con==2) and (l.count(l[0])==2):
  ans='Yes'

print(ans)

Fixed code:
l=[i for i in input()]

ans='No'

con=len(set(l))
if (con==2) and (l.count(l[0])==2):
  ans='Yes'

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


Fixed code:
s=str(input())
s=list(s)
sset=set(s)
sset=list(sset)
if len(sset)==2 and s.count(sset[0])==2:
  print("Yes")
else:
  print("No")
Buggy code:
s=input()
u = set()
for let in s:
  u.add(let)
count=0
for let in s:
  if s[0] == let:
    count += 1
if count ==2 and u.size()==2:
  print('Yes')
else:
  print('No')

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

ans="No"
if S[0] == S[1] and S[0] != S[2] and S[0] != S[3]:
  ans = "Yes"
elif S[1] == S[2] and S[1] != S[0] and S[1] != S[3]:
  ans = "Yes"
elif S[2] == S[3] and S[2] != S[0] and S[2] != S[1]:
  ans = "Yes"
elif S[3] == S[0] and S[3] != S[1] and S[3] != S[2]:
  ans = "Yes"

print(ans)

Fixed code:
S = input()

ans="No"
if S[0] == S[1] and S[0] != S[2] and S[0] != S[3] and S[2] == S[3]:
  ans = "Yes"
elif S[1] == S[2] and S[1] != S[0] and S[1] != S[3] and S[0] == S[3]:
  ans = "Yes"
elif S[2] == S[3] and S[2] != S[0] and S[2] != S[1] and S[0] == S[1]:
  ans = "Yes"
elif S[3] == S[0] and S[3] != S[1] and S[3] != S[2] and S[1] == S[2]:
  ans = "Yes"
elif S[1] == S[3] and S[1] != S[0] and S[1] != S[2] and S[2] == S[0]:
  ans = "Yes"

print(ans)
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()
count = 0
s1 = 0
s2 = 0
A = dict()
N = len(S)
judge = True
for i in range(N):
    if S[i] in A:
        A[S[i]] += 1
        if A[S[i]] > 2 or count > 2:
            judge = False

    else:
        A[S[i]] = 1
        count += 1
if judge:
    print('Yes')
else:
    print('No')

Fixed code:
S = input()
count = 0
s1 = 0
s2 = 0
A = dict()
N = len(S)
judge = True
for i in range(N):
    if S[i] in A:
        A[S[i]] += 1
        if A[S[i]] > 2:
            judge = False

    else:
        A[S[i]] = 1
        count += 1
if count > 2:
    judge = False
    
if judge:
    print('Yes')
else:
    print('No')
Buggy code:
s=list(input())
if set(s)==2 and s.count(s[0]):
	print('Yes')
else:
	print('No')

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

list = []
num = []

for i in str:

    if len(list) is 0:
        list.append(i)
    else:
        if list.count(i) == 0:
                list.append(i)

print(list)

for i in list:
    num.append(str.count(i))

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

    








Fixed code:
str = input()

list = []
num = []

for i in str:

    if len(list) is 0:
        list.append(i)
    else:
        if list.count(i) == 0:
                list.append(i)



for i in list:
    num.append(str.count(i))

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

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

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

Fixed code:
s=list(input())
 
if( s[0] == s[1] and s[1] == s[2] and 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().split()
if s[0]==s[1] and s[1]!=s[2] and s[2]==s[3]:
  print('Yes')
elif s[0]==s[2] and s[1]!=s[2] and s[1]==s[3]:
  print('Yes')
elif s[0]==s[3] and s[0]!=s[1] and s[1]==s[2]:
  print('Yes')
else:
  print('No')

Fixed code:
s = input()

if s[0] == s[1] and s[2] == s[3]:
    if s[0] != s[2]:
        print('Yes')
    else:
        print('No')
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:
S = input()

A = S[0]
ans = 'No'

if A == S[1]:
    B = S[2]
    if B == S[4]:
        ans = 'Yes'
else:
    B = S[1]
    if A == S[2] and B == S[3]:
        ans = 'Yes'
    if B == S[2] and A == S[3]:
        ans = 'Yes'

print(ans)


Fixed code:
S = input()

A = S[0]
ans = 'No'

if A == S[1]:
    B = S[2]
    if B == S[3]:
        ans = 'Yes'
else:
    B = S[1]
    if A == S[2] and B == S[3]:
        ans = 'Yes'
    if B == S[2] and A == S[3]:
        ans = 'Yes'

if A == B:
    ans = 'No'

print(ans)
Buggy code:
a,b,c,d=input()
count=0

if(a==b or a==c or a==d):
    count+=1

if(b==c or b==d or c==d):
    if(b!=a and c!=a and d!=a)
    count+=1

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


Fixed code:
a,b,c,d=input()
count=0

if(a==b):
    count+=1
    if(c==d and a!=c):
        count+=1
elif(a==c):
    count+=1
    if(b==d and a!=b):
        count+=1
elif(a==d):
    count+=1
    if(b==c and a!=b):
        count+=1

if(count==2):
    print("Yes")
else:
    print("No")
Buggy code:
s = input()

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

Fixed code:
s = input()

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

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

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

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

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

d = {}
for x in list(s):
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

print(d)
if len(d.keys()) == 2:
    t = True
    for e in d:
        if d[e] != 2:
            t = False
    if t:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Fixed code:
s = input()

d = {}
for x in list(s):
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

if len(d.keys()) == 2:
    t = True
    for e in d:
        if d[e] != 2:
            t = False
    if t:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy code:
s=int(input())
s.sort()
flag=True
if s[0]==s[1]:
    if s[1]!=s[1]:
        if s[2]==s[3]:
            print("Yes")
            flag=False
if flag:
    print("No")


Fixed code:
s=list(input())
s.sort()
flag=True
if s[0]==s[1]:
    if s[1]!=s[2]:
        if s[2]==s[3]:
            print("Yes")
            flag=False
if flag:
    print("No")
Buggy code:
import sys

def mozi(S):
    s = list(S)
    s2 = list(set(s))
    if len(s2) != 2:
        ans = 'No'
        return ans
    else:
        p = 0
        q = 0
        for item in s:
            if item == s2[0]:
                p+=1
            if item == s2[1]:
                q+=1
        if p == 2 and q == 2:
            ans = 'Yes'
            return ans
        else:
            ans = 'No'
            return ans

args = sys.argv
S = args[0]
print(mozi(S))


Fixed code:
def mozi(S):
    s = list(S)
    s2 = list(set(s))
    if len(s2) != 2:
        ans = 'No'
        return ans
    else:
        p = 0
        q = 0
        for item in s:
            if item == s2[0]:
                p+=1
            if item == s2[1]:
                q+=1
        if p == 2 and q == 2:
            ans = 'Yes'
            return ans
        else:
            ans = 'No'
            return ans

#args = sys.argv
#S = args[0]
S = input()
print(mozi(S))
Buggy code:
l = input()
a = l[0]
b = l[1]
c = l[2]
d = l[3]


while(True):
    if(a==b and b==c and c==d):
        print("No")
        break
    if(a==b and c==d):
        print("Yes")
        break
    if(a==c and b==d):
        print("Yes")
        break
    if(a==d and c==b):
        print("Yes")
        break
    print("No")

Fixed code:
l = input()
a = l[0]
b = l[1]
c = l[2]
d = l[3]


while(True):
    if(a==b and b==c and c==d):
        print("No")
        break
    if(a==b and c==d):
        print("Yes")
        break
    if(a==c and b==d):
        print("Yes")
        break
    if(a==d and c==b):
        print("Yes")
        break
    else:
      print("No")
      break
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())
if len(S)==4:
    if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]:
        print('Yes')
    if S[0]==S[2] and S[1]==S[3] and S[0]!=S[3]:
        print('Yes')
    if S[0]==S[3] and S[1]==S[2] and S[0]!=S[1]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

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

word =input()
flag = 0

for i in range(4):
    if word.count(word[i]) == 2:
        flag += 1
    
if flag == 4:
    print("yes")
else:
    print("No")

Fixed code:
import sys 

word =input()
flag = 0

for i in range(4):
    if word.count(word[i]) == 2:
        flag += 1
    
if flag == 4:
    print("Yes")
else:
    print("No")
Buggy code:
s = input()
arr = list(s)
arr.sort()
if arr[0]==arr[1] and arr[1] != arr[2]:
  print('Yes')
else:
  print('No')

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

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

Fixed code:
w=input()
s=list(set(list(w)))

if len(s) == 2 and w.count(s[0]) == 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]:
  if s[2]==s[3] and s[1]!=s[2]:
    print('Yes')
  else:
    print('No')
else:
  print('No')
Buggy code:
s = list(input())
s.sort()
print(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.sort()
#print(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()
Slen = len(S)
cnt=[0,0,0]
flg = True
for i in range(Slen-1):
  
  for j in range(Slen):
    if S[i]==S[j]:
      cnt[i] += 1
  
  print(i,cnt[i])
  if cnt[i] < 2 or cnt[i] > 2:
    flg = False
    print(flg)
    break

if flg == True:
  print("Yes")
else:
  print("No")

Fixed code:
S = input()
Slen = len(S)
cnt=[0,0,0]
flg = True
for i in range(Slen-1):
  
  for j in range(Slen):
    if S[i]==S[j]:
      cnt[i] += 1
  
  if cnt[i] < 2 or cnt[i] > 2:
    flg = False
    break

if flg == True:
  print("Yes")
else:
  print("No")
Buggy code:
def main():
    a= input()
    print(a)

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


if __name__ == "__main__":
    main()

Fixed code:
def main():
    a= input()

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


if __name__ == "__main__":
    main()
Buggy code:
s = (input()

s1 = s[0]
if s.count(s1) == 2:
    s = s.replace(s1, "")
    s2 = s[0]
    if s.count(s2) == 2:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Fixed code:
s = input()

s1 = s[0]
if s.count(s1) == 2:
    s = s.replace(s1, "")
    s2 = s[0]
    if s.count(s2) == 2:
        print('Yes')
    else:
        print('No')

else:
    print('No')
Buggy code:
input_ = input()

input_str = set(input_)

input_str_arr = [s for s in input_str]

if len(set(input_str_arr))==2:
    consunt()
else:
    print("No")
    

def consunt():
    if input_.count(input_str_arr[0]) and input_.count(input_str_arr[1]):
      print("Yes")
    else:
      print("No")

Fixed code:
def consunt():
    if input_.count(input_str_arr[0]) and input_.count(input_str_arr[1]):
      print("Yes")
    else:
      print("No")

input_ = input()

input_str = set(input_)

input_str_arr = [s for s in input_str]

if len(set(input_str_arr))==2:
    consunt()
else:
    print("No")
Buggy code:
check = True

if len(set(list(s))) == len(s):
    pass
else:
    for c in list(set(list(s))):
        if list(s).count(c) != 2:
            if check:
                print('No')
                check = False
    if check:
        print('Yes')

Fixed code:
s = input()

check = True
 
if len(set(list(s))) == len(s):
  print('No')
else:
    for c in list(set(list(s))):
        if list(s).count(c) != 2:
            if check:
                print('No')
                check = False
    if check:
        print('Yes')
Buggy code:
s = input()
if s[0] == s[1] == s[2] == s[3]:
  print('No')
  break
if 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')


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

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