qyliang/CodeNanoFix huggingface dataset:
Buggy code:
#!/usr/bin/env python


while True :
	S = input('S = ')
	if len(S) == 4 and S.isupper() :
		break
	else :
		continue


char_list = list(S)

judge = 0


for i in range(3) :
	for j in range(3-i) : 
		if char_list[i] == char_list[i+j+1] :
			judge = judge + 1

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


Fixed code:
#!/usr/bin/env python


while True :
	S = input()
	if len(S) == 4 and S.isupper() :
		break
	else :
		continue


char_list = list(S)

judge = 0


for i in range(3) :
	for j in range(3-i) : 
		if char_list[i] == char_list[i+j+1] :
			judge = judge + 1

if judge == 2 :
	print('Yes')
else :
	print('No')
Buggy code:
import collections

s = list(input().rstrip())
c = colc.Counter(s)

if len(c.keys()) != 2:
  print("No")

else:
  if c.most_common()[0][1] != 2:
    print("No")
  else:
    print("Yes")

Fixed code:
import collections as coll
 
s = list(input().rstrip())
c = coll.Counter(s)
 
if len(c.keys()) != 2:
  print("No")
 
else:
  if c.most_common()[0][1] != 2:
    print("No")
  else:
    print("Yes")
Buggy code:
S = input()

if (S[0]==S[1] and S[2]==S[3] and S[1]!=S[2])or (S[1]==S[2] and S[0]==S[3] and S[0]!=S[1])or (S[0]==S[2] and S[1]==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[1]!=S[2])or (S[1]==S[2] and S[0]==S[3] and S[0]!=S[1])or (S[0]==S[2] and S[1]==S[3] and S[1]!=S[2]):
  print("Yes")
else:
  print("No")
Buggy code:
t = input()
a = [i for i in t]
print(a)
b = list(set(a))
if len(b) == 2:
    if a.count(a[0]) ==2:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Fixed code:
t = input()
a = [i for i in t]
b = list(set(a))
if len(b) == 2:
    if a.count(a[0]) ==2:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy code:
letters = list(input())
true_false = 1
for letter in letters:
  if letters.count(letter) == 2:
    true_false　*= 1
  else:
    true_false *= 0
print(["No","Yes"][true_false])


Fixed code:
letters = list(input())
x = 1
for letter in letters:
        if letters.count(letter) == 2:
            x *= 1
        else:
            x *= 0
print(["No","Yes"][x])
Buggy code:
S = input()
SS = list(S)
print(S)
boo = False
boo2 = False
s1 = S[0]
s2 = S[1]
s3 = S[2]
s4 = S[3]
if s1 == s2:
    SS.pop(1)
    SS.pop(0)
elif s1 == s3:
    SS.pop(2)
    SS.pop(0)
elif  s1 == s4:
    SS.pop(3)
    SS.pop(0)
elif s2 == s3:
    SS.pop(2)
    SS.pop(1)
elif s2 == s4:
    SS.pop(3)
    SS.pop(1)
elif s3 == s4:
    SS.pop(3)
    SS.pop(2)
    
if len(SS) == 4:
    print("No")
elif SS[0] == SS[1]:
    print("Yes")
else:
    print("No")


Fixed code:
S = input()
SS = list(S)
boo = False
boo2 = False
s1 = S[0]
s2 = S[1]
s3 = S[2]
s4 = S[3]
buf = ""
if s1 == s2:
    buf =SS.pop(1)
    buf =SS.pop(0)
elif s1 == s3:
    buf=SS.pop(2)
    buf=SS.pop(0)
elif  s1 == s4:
    buf=SS.pop(3)
    buf=SS.pop(0)
elif s2 == s3:
    buf=SS.pop(2)
    buf=SS.pop(1)
elif s2 == s4:
    buf=SS.pop(3)
    buf=SS.pop(1)
elif s3 == s4:
    buf=SS.pop(3)
    buf=SS.pop(2)
    
if len(SS) == 4:
    print("No")
elif SS[0] == SS[1] and buf != SS[0]:
    print("Yes")
else:
    print("No")
Buggy code:
S=input()

from collections import Counter

c=Counter([S[0],S[1],S[2],S[3]])

if len(list(c.keys()))==2:
    flag=True
    for key in c.keys():
        if c[key]!=2:
            flag=False:
            break

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

Fixed code:
S=input()

from collections import Counter

c=Counter([S[0],S[1],S[2],S[3]])

if len(list(c.keys()))==2:
    flag=True
    for key in c.keys():
        if c[key]!=2:
            flag=False
            break

    if flag:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy code:
cnt = 0
for moji in s:
    #print(moji)
    num = s.count(moji)
    #print(num)
    if num == 2:
        cnt+=1
    else:
        break
        
if cnt == 4:
    print("Yes")
else:
    print("No")

Fixed code:
s = str(input())
cnt = 0
for moji in s:
    #print(moji)
    num = s.count(moji)
    #print(num)
    if num == 2:
        cnt+=1
    else:
        break
        
if cnt == 4:
    print("Yes")
else:
    print("No")
Buggy code:
S=input()
s=list(S)
if s[1]==s[2] and s[3]==s[4] and s[2]!=s[3]:
	print("Yes")
elif s[1]==s[3] and s[2]==s[4] and s[1]!=s[3]:
	print("Yes")
elif s[1]==s[4] and s[2]==s[3] and s[1]!=s[2]:
	print("Yes")
else:
	print("No")

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


Fixed code:
S = list(str(input()))
if (S[0]==S[1]) and (S[0]==S[2]) and (S[0]==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:
#s=list(input())
s=list("ASSA")
d = {}
for hoge in s:
  d[hoge] = d.get(hoge, 0) + 1

for k, v in d.items():
  if(v != 2):
    print("No")
print("Yes")

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

for k, v in d.items():
  if(v != 2):
    print("No")
    exit()
print("Yes")
Buggy code:
S = input()
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:

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 = list(input())
S_cnt = dict()

for s in S:
  if s in S_cnt.keys():
    S_cnt[s] += 1
  else:
    S_cnt[s] = 1
    
res = 'Yes'
for s in S_dict.keys():
  if S_dict[s] != 2:
    res = 'No'
print(res)


Fixed code:
S = list(input())
S_cnt = dict()

for s in S:
  if s in S_cnt.keys():
    S_cnt[s] += 1
  else:
    S_cnt[s] = 1
    
res = 'Yes'
for s in S_cnt.keys():
  if S_cnt[s] != 2:
    res = 'No'
print(res)
Buggy code:
import sys
input = sys.stdin.readline
ri = lambda: int(input())
#rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

S = list(input())[:4]
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:
import sys
input = sys.stdin.readline
ri = lambda: int(input())
#rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

S = input()
ans = 0
if S.count(S[0]) == 2:
    for i in range(1,4):
        if S[0] != S[i] and S.count(S[i]) == 2:
            ans = 1

yn(ans)
Buggy code:
S = input()
x = list(set(S))
print("Yes" if len(set(S)) == 2 and len(S.remove(x[0])) == 2 and len(S.remove(x[1])) == 2 else "No")


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


solve()


Fixed code:
def solve():
    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')


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

Fixed code:
S = input().strip()
listS = list(S)
listS.sort()
if listS[0] == listS[1] and listS[2] == listS[3] and listS[0] != listS[2] and listS[1] != listS[3]:
    print("Yes")
else:
    print("No")
Buggy code:
S = input()
c = collections.Counter(S)
values, counts = zip(*c.most_common())
a = 0
for i in counts:
    if i==2:
        a += 1
    else:
        a *= 0
if a:
    print("Yes")
else:
    print("No")


Fixed code:
import collections
S = input()
c = collections.Counter(S)
values, counts = zip(*c.most_common())
a = 0
for i in counts:
    if i==2:
        a += 1
    else:
        a *= 0
if a:
    print("Yes")
else:
    print("No")
Buggy code:
S = str(input())
s = list(S)
if s[0] == s[1]:
    if s[2] == s[3]:
        print("Yes")
else:
    print("No")
    

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

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:
s = input()
f = 1 
if (s[0] == s[1] and s[2] == s[3] and s[1] != s[2]) or ((s[:2] == s[2:] or s[1::-1] == s[2:]) and s[1] != s[2]):
        f = 0 
print('YNeos'[f::2])

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

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

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

Fixed code:
s = input()
s = len(set(s[i] for i in range(len(s))))
if s==2:
    print('Yes')
else:
    print('No')
Buggy code:
a = list(map(str,input()))
if a[0] = a[1] and a[2] = a[3] and a[0] != a[2]:
    print("Yes")
elif a[0] = a[3] and a[1] = a[2] and a[0] != a[1]:
    print("Yes")
elif a[0] = a[2] and a[1] = a[3] and a[0] != a[1]:
    print("Yes")
else:
    print("No")
  
    
    
        
    

Fixed code:
a = list(map(str,input()))
if a[0] == a[1] and a[2] == a[3] and a[0] != a[2]:
    print("Yes")
elif a[0] == a[3] and a[1] == a[2] and a[0] != a[1]:
    print("Yes")
elif a[0] == a[2] and a[1] == a[3] and a[0] != a[1]:
    print("Yes")
else:
    print("No")
Buggy code:
S = list(input())
result = []
if len(set(S))==2:
  for s in S:
    result.append(S.count(s))
    if (result[0]==result[1]) == 2:
      print("Yes")
  

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

def main():
    S=list(map(str,input()))
    l_duplicate = [x for x in set(S) if S.count(x) ==2]
    if len(l_duplicate):
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    main()

Fixed code:

def main():
    S=list(map(str,input()))
    l_duplicate = [x for x in set(S) if S.count(x) ==2]

    if len(l_duplicate)==2:
        print("Yes")
    else:
        print("No")

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

s.sort()

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

    

Fixed code:
s = list(input())

s.sort()

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

a = sorted(s)

print(a)

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

Fixed code:
s = list(input())

a = sorted(s)

if a[0] == a[1] and a[2] == a[3] and a[0] != a[2]:
    print('Yes')
else:
    print('No')
Buggy code:
from sys import exit, stdin
from collections import Counter
S = Counter(stdin.readline().rstrip())
if len(S.keys()) == 2 and set(S.values()) == {2}:
    print("Yes")

Fixed code:
from sys import exit, stdin
from collections import Counter
S = Counter(stdin.readline().rstrip())
if len(S.keys()) == 2 and set(S.values()) == {2}:
    print("Yes")
else:
    print("No")
Buggy code:
# @author 

import sys

class AFiftyFifty:
    def solve(self):
        s = list(input())
        s.sort()
        print("Yes" if (s[0] == s[1] and s[2] == s[3]) else "No")


solver = AFiftyFifty()
input = sys.stdin.readline

solver.solve()


Fixed code:
# @author 

import sys

class AFiftyFifty:
    def solve(self):
        s = list(input().strip())
        s.sort()
        print("Yes" if (s[0] == s[1] and s[2] == s[3] and s[0] != s[2]) else "No")


solver = AFiftyFifty()
input = sys.stdin.readline

solver.solve()
Buggy code:
S=list(input())
S.sort()
print(S)
if S[0]==S[1] and S[1] != S[2]:
    print("Yes")
else:
    print("No")

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

Fixed code:
b_list = list(str(input()))
b_list = sorted(b_list)

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

if a[0] == a[1] and a[2] == a[3] and a[0] != a[2]:
  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()
flag =False
S_set = set(list(S))

if len(S_set) == 2:
  count_1 = S.count(list(S_set)[0])
  count_2 = S.count(list(S_set)[1])
  if count_1 == 2 and count_2 == 2:
  	falg = True

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

Fixed code:
S = input()
flag =False
S_set = set(list(S))

if len(S_set) == 2:
  count_1 = S.count(list(S_set)[0])
  count_2 = S.count(list(S_set)[1])
  if count_1 == 2 and count_2 == 2:
  	flag = True

if flag:
  print('Yes')
else:
  print('No')
Buggy code:
S = input()

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

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

else:
  print("No")
Buggy code:

def main():
    s = input()
    s_ = list(set(s))
    if s.count(s_[0]) == 2 and len(s_) == 2i:
        print('Yes')
    else:
        print('No')
   

if __name__ == "__main__":
    main()


Fixed code:

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

if __name__ == "__main__":
    main()
Buggy code:
	from itertools import groupby

s = input()
result = True

for k, g in groupby(s):
        print(k, list(g))
        if s.count(k) is not 2:
                result = False

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

Fixed code:
from itertools import groupby

s = input()
result = True

for k, g in groupby(s):
        if s.count(k) is not 2:
                result = False

if result:
        print('Yes')
else:
        print('No')
Buggy code:
s=sorted(input())
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 = sorted(S)

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

str = str(input())
list = []
for c in str:
  list.append(c)
list.sort()
if list[0] == list[2]:
    print("No")
    sys.exit()
if list[0] == list[1]:
  if list[2] == list[3]:
    print("Yes")
    sys.exit()
else:
  print("No")

Fixed code:
import sys

str = str(input())
list = []
for c in str:
  list.append(c)
list.sort()

if list[0] == list[2]:
    print("No")
    sys.exit()
if list[0] == list[1]:
  if list[2] == list[3]:
    print("Yes")
    sys.exit()
print("No")
Buggy code:
s = input()
l = len(s)
set_s = set(s)

if l == 4 and len(a) == 2:
    print('Yes')
else:
    print('No')

Fixed code:
s = input()
l = len(s)
set_s = set(s)

if l == 4 and len(set_s) == 2:
    print('Yes')
else:
    print('No')
Buggy code:
from collections import Counter
s = input()
x = Counter(s)
y = sorted(list(x.values()))
print(y)
if y[0]*y[-1] == 4:
    print("Yes")
else:
    print("No")

Fixed code:
from collections import Counter
s = input()
x = Counter(s)
y = sorted(list(x.values()))
if y[0]*y[-1] == 4:
    print("Yes")
else:
    print("No")
Buggy code:
S=str(input())
if S[0]==S[1] and S[2]==S[3]:
  print('Yes')
else if S[0]==S[2] and S[1]==S[3]:
  print('Yes')
else if S[0]==S[3] and S[1]==S[2]:
  print('Yes')
else:
  print('No')

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

a=s[0]
b=''
for i in range(1,4):
  if s[i]!=b:
    b=s[i]
ca=0
cb=0
for i in range(4):
  if s[i]!=a and s[i]!=b:
    print('No')
    exit()
  if s[i]==a:
    ca+=1
  elif s[i]==b:
    cb+=1
if ca==2 and cb==2:
  print('Yes')
else:
  print('No')

Fixed code:
s=input()

a=s[0]
b=''
for i in range(1,4):
  if s[i]!=a:
    b=s[i]
    break
ca=0
cb=0
for i in range(4):
  if s[i]!=a and s[i]!=b:
    print('No')
    exit()
  if s[i]==a:
    ca+=1
  elif s[i]==b:
    cb+=1
if ca==2 and cb==2:
  print('Yes')
else:
  print('No')
Buggy code:
s = input()
a = s[0]
b = s[1]
c = s[2]
d = s[3]

if a=b and c=d:
  print("Yes")
elif a=c and b=d:
  print("Yes")
elif a=d and b=c:
  print("Yes")
else:
  print("No")

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

if a==b==c==d:
  print("No")
elif a==b and c==d:
  print("Yes")
elif a==c and b==d:
  print("Yes")
elif a==d and b==c:
  print("Yes")
else:
  print("No")
Buggy code:

s=list(input())
c = collections.Counter(s)
if list(c.values())==[2,2]:
    print("Yes")
else:
    print("No")

Fixed code:

s=list(input())
import collections
s = collections.Counter(s)
if list(s.values())==[2,2]:
    print("Yes")
else:
    print("No")
Buggy code:
s = input()
ans = 'No'
a = {x for x in s}
if len(a) == 2:
  if a.count(a[0]) == 2 and a.count(a[1]) == 2:
    ans = 'Yes'
    
print(ans)

Fixed code:
s = input()
ans = 'No'
a = list({x for x in s})
if len(a) == 2:

  if s.count(a[0]) == 2 and s.count(a[1]) == 2:
    ans = 'Yes'
    
print(ans)
Buggy code:
s=input()
s=sorted(s)

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

a=s[0]
b=s[1]
c=s[2]
d=s[3]

if a==b and c==d:
  print('Yes')
elif a==c and b==d:
  print('Yes')
elif a==d and c==d:
  print('Yes')
else:
  print('No')

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


if a==b and c==d and a!=c:
  print('Yes')
elif a==c and b==d and a!=b:
  print('Yes')
elif a==d and c==b and a!=c:
  print('Yes')
else:
  print('No')
Buggy code:
S = input()
from collections import Counter
C = Counter(S)
if list(C.values())==(2,2):
  print("Yes")
else:
  print("No")

Fixed code:
from collections import Counter
S = input()
C = Counter(S)
if list(C.values()) == [2, 2]:
    print("Yes")
else:
    print("No")
Buggy code:
i = input()
j = [_ for _ in i]
set(j)
if len(j) == 2:
  print("Yes")
else:
  print("No")

Fixed code:
i = input()
j = [_ for _ in i]
j = set(j)
if len(j) == 2:
  print("Yes")
else:
  print("No")
Buggy code:
S=list(input())
H=['']*4
for i in range(4):
    H[i]=S[i]
A=list(set(H))
if S.count(A[0])==2 and S.count(A[1])==2:
    print('Yes')
else:
    print('No')
print(H)

Fixed code:
S=list(input())
H=['']*4
for i in range(4):
    H[i]=S[i]
A=list(set(H))
if S.count(A[0])==2 and S.count(A[1])==2:
    print('Yes')
else:
    print('No')
Buggy code:
S=list(input())
ans = "No"
if(S[0] == S[1]) and (S[1] != S[2]) and (S[2] == S[3]):
  ans = "Yes"
print(ans)

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

Fixed code:
S = list(input())
S.sort()
if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
    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())
S2 = sorted(S)

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

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

Fixed code:
n=input()
m=set(n)
if len(m)==2 and n.count(n[0])==2:
    print("Yes")
else:
    print("No")
Buggy code:
S = input()
cnt = 0
for i in range(len(S)-1):
    for j in range(1, len(S)):
        if S[i] == S[j]:
            cnt += 1

if cnt == 2:
    print("Yes")

else:
    print("No")

Fixed code:
S = input()
cnt = 0
for i in range(len(S)-1):
    for j in range(i+1, len(S)):
        if S[i] == S[j]:
            cnt += 1

if cnt == 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])
   and (s[0]===s[3] and s[1]==s[2] and 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]) 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 = set(input())
    print("Yes" if len(S) == 2 else "No")


Fixed code:
S = set(input())
print("Yes" if len(S) == 2 else "No")
Buggy code:
a=map(str, input())
char=list(a)
b=set(char)
c=len(b)
if c=2:
	print("Yes")
else:
  print("No")
  
  

Fixed code:
a=map(str, input())
char=list(a)
b=set(char)
c=len(b)
if c==2:
	print("Yes")
else:
  print("No")
Buggy code:
A = input()
if len(set(A) == 2 & A.count(A[0]) == 2:
       print('Yes')
else:
       print('No')

Fixed code:
A = list(input())
print('Yes' if len(set(A)) == 2 & A.count(A[0]) == 2 else 'No')
Buggy code:
s = input()
ans = []
for i in range(4):
    ans.append(s[i])

ans.sort()
print('Yes' if ans[0] == ans[1] and ans[2] == ans[3] ans ans[0] != ans[2] else 'No')

Fixed code:
s = input()
ans = []
for i in range(4):
    ans.append(s[i])

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

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