Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

def lcm(a,b):
    return (a*b)//gcd(a,b)

N, M = map(int,input().split())
S = input()
T = input()
L = lcm(N,M)
d1 = L//N
d2 = L//M
d = lcm(d1,d2)
l = list(range(L))
l = l[::d]
b = True
for i in l:
    if S[i//d1] != T[i//d2]:
        print(-1)
        sys.exit()

print(L)


Fixed submission:
import sys

def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

def lcm(a,b):
    return (a*b)//gcd(a,b)

N, M = map(int,input().split())
S = input()
T = input()
d = gcd(N,M)
L = lcm(N,M)
for i in range(d):
    if S[i*(N//d)] != T[i*(M//d)]:
        print(-1)
        sys.exit()

print(L)

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

def lcm(a,b):
    return (a*b)//gcd(a,b)

N, M = map(int,input().split())
S = input()
T = input()
L = lcm(N,M)
d1 = L//N
d2 = L//M
d = lcm(d1,d2)
l = list(range(L))
l = l[::d]
b = True
for i in l:
    if S[i//d1] != T[i//d2]:
        b = False
        break

if not b:
    L = -1
print(L)


Fixed submission:
import sys

def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

def lcm(a,b):
    return (a*b)//gcd(a,b)

N, M = map(int,input().split())
S = input()
T = input()
d = gcd(N,M)
L = lcm(N,M)
for i in range(d):
    if S[i*(N//d)] != T[i*(M//d)]:
        print(-1)
        sys.exit()

print(L)

Buggy python submission (verdict: Runtime Error):
import math
import pprint

def lcm(a,b):
    return (a*b)//math.gcd(a,b)

N, M = map(int,input().split())
S = input()
T = input()
L = lcm(N,M)
d1 = L//N
d2 = L//M
d = lcm(d1,d2)
l = list(range(L))
l = l[::d]
b = True
for i in l:
    if S[i//d1] != T[i//d2]:
        b = False
        break

if not b:
    L = -1
print(L)


Fixed submission:
import sys

def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

def lcm(a,b):
    return (a*b)//gcd(a,b)

N, M = map(int,input().split())
S = input()
T = input()
d = gcd(N,M)
L = lcm(N,M)
for i in range(d):
    if S[i*(N//d)] != T[i*(M//d)]:
        print(-1)
        sys.exit()

print(L)
Buggy python submission (verdict: Runtime Error):
X, A = map(int, input().split())
if x < A:
    print(0)
else:
    print(10)

Fixed submission:
x,A = map(int,input().split())
if x < A:
    print(0)
else:
    print(10)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

K = set(range(1, N + 1))
for i in range(M):
    l, r = map(int, input().split())
    K = K & set(range(l, r + 1))

print(len(K))

Fixed submission:
N, M = map(int, input().split())
L = 1
R = N

for i in range(M):
    l, r = map(int, input().split())
    
    if l > L:
        L = l
#        print('L ' + str(L))
    if r < R:
        R = r
#        print('R ' + str(R))
        
if L > R:
    print(0)
else:
    print(R - L + 1)
Buggy python submission (verdict: Runtime Error):
def del_list(L, I):
    diff = 0
    
    for i in I[::-1]:
        diff += L[i]
        del L[i]
    return L, diff

N, M = map(int, input().split())

A = list(map(int,input().split()))
A.sort()

bc = []
for i in range(M):
    bc.append(list(map(int, input().split())))
    

bc.sort(key=lambda x:x[1], reverse=True)

ans = 0
for BC in bc:
    if BC[1] <= A[0]:
#        print('break')
        break
    
    indexes = [i for i, x in enumerate(A) if x < BC[1]]
    
#    print(indexes)
    if len(indexes) > BC[0]:
        A, diff = del_list(A, indexes[0:BC[0]])
        ans += BC[1] * BC[0]

#        del(A[indexes[0:BC[0]]])
    elif len(indexes) == BC[0]:
        A, diff = del_list(A, indexes)
        ans += BC[1] * BC[0]
#        del(A[indexes])
    elif len(indexes) <= BC[0]:
        A, diff = del_list(A, indexes)
        ans += BC[1] * len(indexes)
        
#    print(ans)
#    print(A)

ans += sum(A)
        
print(ans)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int,input().split()))
A.sort()
bc = []
for i in range(M):
    bc.append(list(map(int, input().split())))
bc.sort(key=lambda x:x[1], reverse=True)

ans = 0

BC = bc[0]
bc_i = 0
ans += sum(A)
for i in range(len(A)):
    
    if BC[1] > A[i]:
        ans += BC[1] - A[i]
        BC[0] -= 1
    
    if BC[0] == 0:
        if bc_i == len(bc) - 1:
            break
        else:
            bc_i += 1
            BC = bc[bc_i]
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import re
N,Q = map(int,input().split())	

S = input()

for _ in range(Q):
    l,r = map(int,input().split())	
    print(len(re.findall('AC', S[l-1:r])))


Fixed submission:
N,Q = map(int,input().split())	

S = input()

t = [0] * N
for i in range(1, N):
    if S[i-1:i+1] == 'AC':
        t[i] = t[i-1] + 1
    else:
        t[i] = t[i-1]
#    print(t)

for _ in range(Q):
    l,r = map(int,input().split())	
    print(t[r-1]-t[l-1])

Buggy python submission (verdict: Runtime Error):
import re
N,Q = map(int,input().split())	

S = input()

for _ in range(N):
    l,r = map(int,input().split())	
    print(len(re.findall('AC', S[l-1:r])))


Fixed submission:
N,Q = map(int,input().split())	

S = input()

t = [0] * N
for i in range(1, N):
    if S[i-1:i+1] == 'AC':
        t[i] = t[i-1] + 1
    else:
        t[i] = t[i-1]
#    print(t)

for _ in range(Q):
    l,r = map(int,input().split())	
    print(t[r-1]-t[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

A = []
#B = []
for i in range(N):
#    print(i)
#    a, b = map(int, input().split())
    A.append(list(map(int, input().split())))
#    B.append(b)
    
    A.sort(key=lambda x: x[0])

ans = 0
for i in range(N):
    if A[i][1] > M:
        ans += A[i][0] * M
        break
    else:
        ans += A[i][0] * A[i][1]
        M -= A[i][1]

print(ans)

Fixed submission:
N, M = map(int, input().split())

A = []
#B = []
for i in range(N):
#    print(i)
#    a, b = map(int, input().split())
    A.append(list(map(int, input().split())))
#    B.append(b)
    
A.sort(key=lambda x: x[0])

ans = 0
for i in range(N):
    if A[i][1] > M:
        ans += A[i][0] * M
        break
    else:
        ans += A[i][0] * A[i][1]
        M -= A[i][1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

ans = 0
for i in range(A, B+1):
#    print(i)
    ans = ans ^ i
    
print(ans)

Fixed submission:
def f_n(n):
    if n % 2 == 0:
        return(n // 2 % 2 ^ n)
    else:
        return((n+1) // 2 % 2)

def f_ab(A, B):
    return(f_n(A-1) ^ f_n(B))
    
    
A, B = map(int, input().split())

print(f_ab(A, B))
Buggy python submission (verdict: Runtime Error):
r i in range(A):
    S.append(int(input()))

S = [-INF] + S + [INF]

T = []
for i in range(B):
    T.append(int(input()))

T = [-INF] + T + [INF]


for i in range(Q):
    x = int(input())
    
    d, b = bisect.bisect_right(S, x), bisect.bisect_right(T, x)
    
    res = INF
    for s in [S[d - 1], S[d]]:
        for t in [T[b - 1], T[b]]:
            res = min(res, 
                      abs(s - x) + abs(s - t),
                      abs(t - x) + abs(s - t))
            
    print(res)

Fixed submission:
import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
    x = int(input())
    b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
    res = INF
    for S in [s[b - 1], s[b]]:
        for T in [t[d - 1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            res = min(res, d1, d2)
    print(res)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

g = [0] * (N + 1)
for i in range(N):
    g[i+1] = math.gcd(g[i], A[i])

print(g[-1])

Fixed submission:
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

g = [0] * (N + 1)
for i in range(N):
    g[i+1] = gcd(g[i], A[i])

print(g[-1])

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

g = 0
for i in range(N):
    g = math.gcd(g, A[i])

print(g)

Fixed submission:
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

g = [0] * (N + 1)
for i in range(N):
    g[i+1] = gcd(g[i], A[i])

print(g[-1])

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

g = math.gcd(A[0], A[1])
for i in range(2, N):
    g = math.gcd(g, A[i])

print(g)

Fixed submission:
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

g = [0] * (N + 1)
for i in range(N):
    g[i+1] = gcd(g[i], A[i])

print(g[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

a = [0] * M
b = [0] * M

for i in range(M):
    a[i], b[i] = map(int, input().split())

# N in b    
indices = [i for i, x in enumerate(b) if x == N]
# matched b of a in b
for i in range(len(indices)):
#    print(a[indices[i]])
#    print(b[indices[i]])
    
    indices_2 = [ii for ii, x in enumerate(b) if x == a[indices[i]]]
    
#    print(indices_2)
    
    if len(indices_2) == 0:
        continue
    
    for j in range(len(indices_2)):
#        print(indices_2)
#        print(a[indices_2[j]])
        
        if a[indices_2[j]] == 1:
            print('POSSIBLE')
            quit()
            
print('IMPOSSIBLE')


Fixed submission:
a=[]
b={}
n,m=map(int,input().split())
for _ in range(m):
	i,j=map(int,input().split())
	if i==1:
		a.append(j)
	elif j==n:
		b[i]=1
for i in a:
	if i in b:
		print('POSSIBLE')
		break
else:
	print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M, *UV, S, T = map(int, read().split())

it = iter(UV)
G = [[] for _ in range(1+N+N+N)]
for x, y = in zip(it, it):
    x1 = x + N; x2 = x1 + N;
    y1 = y + N; y2 = y1 + N;
    G[x].append(y1)
    G[x1].append(y2)
    G[x2].append(y)

INF = 10 ** 15
dist = [INF] * (N + N + N + 1)
dist[S] = 0
q = [S]
while q:
    qq = []
    for x in q:
        for y in G[x]:
            if dist[y] != INF:
                continue
            qq.append(y)
            dist[y] = dist[x] + 1
            if y == T:
                break
    q = qq

d = dist[T]

answer = -1 if d == INF else d//3
print(answer)



Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M,*UV,S,T = map(int,read().split())

it = iter(UV)
G = [[] for _ in range(1+N+N+N)]
for x, y in zip(it, it):
    x1=x+N; x2=x1+N;
    y1=y+N; y2=y1+N;
    G[x].append(y1)
    G[x1].append(y2)
    G[x2].append(y)

INF = 10 ** 15
dist = [INF] * (N+N+N+1)
dist[S] = 0
q = [S]
while q:
    qq = []
    for x in q:
        for y in G[x]:
            if dist[y] != INF:
                continue
            qq.append(y)
            dist[y] = dist[x] + 1
            if y == T:
                break
    q = qq

d = dist[T]

answer = -1 if d == INF else d//3
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split())
n=0
for i in range(b-a+1):
    if (i+a)%c!=0 and (i+a)%d!=0:
        n+=1
print(n)

Fixed submission:
a,b,c,d = map(int,input().split())
c_=0
d_=0
n=0
if a%c!=0 and b>c:
    c_= a+c-a%c #12
    n+=1
elif b<c:
    c_= b
else:
    c_ = a
    n+=1
if a%d!=0 and b>d:
    d_= a+d-a%d #16
    n+=1
elif b<d:
    d_= b
else:
    d_ = a
    n+=1
r = max(c,d)%min(c,d)
b_=min(c,d)
while r!=0:
    a_= b_
    b_=r
    r=a_%b_
e = int(c*d/b_)
if a%e!=0 and b>e:
    e_= a+e-a%e #48
    n-=1
elif b<e:
    e_= b
else:
    e_ = a
    n-=1
n += (b-c_)//c+(b-d_)//d-(b-e_)//e
print(1+b-a-n)
Buggy python submission (verdict: Runtime Error):
    n = int(input())
    p_list = list(map(int, input().split()))
    count = 0
    for i in range(len(p_list)-2):
    	if (p_list[i]<p_list[i+1] and p_list[i+1]<p_list[i+2]) or (p_list[i]>p_list[i+1] and p_list[i+1]>p_list[i+2]):
    		count += 1
    print(count)

Fixed submission:
n = int(input())
p_list = list(map(int, input().split()))
count = 0
for i in range(len(p_list)-2):
	if (p_list[i]<p_list[i+1] and p_list[i+1]<p_list[i+2]) or (p_list[i]>p_list[i+1] and p_list[i+1]>p_list[i+2]):
		count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s = int (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[2]:
    print('Yes')
else:
    print('No')
        

Fixed submission:
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[2]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
def myInput():
  n=input()
  s=input()
  return(n,[int(i) for i in s.split()])

def func():
  n, lst1 = nyInput()
  cnt = 0
  for i in range(1, int(n)-1):
    if min(lst[i+1],max(lst1[i],lst1[i-1])) == lst1[i]:
      cnt+=1
    elif min(lst1[i-1], max(lst1[i],lst1[i+1])) == lst1[i]:
      cnt+=1
  return cnt
print(func())

Fixed submission:
def myInput():
  n = input()
  s = input()
  return (n, [int(i) for i in s.split()])

def func():
  n, lst1 = myInput()
  cnt = 0
  for i in range(1, int(n)-1):
    if min(lst1[i+1],max(lst1[i], lst1[i-1])) == lst1[i]:
      cnt+=1
    elif min(lst1[i-1],max(lst1[i],lst1[i+1])) == lst1[i]:
      cnt += 1
  return cnt
print(func())
Buggy python submission (verdict: Runtime Error):
s = input()
ss = list(s)

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

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
tamanho=list(map(int,input().rstrip().split()))
conjunto=set()

for i in range(tamanho[1]):
  linha=list(map(int,input().rstrip().split()))
  for j in range(1,linha[0]):
    conjunto.add(j)
  for k in range(linha[1]+1,tamanho[0]+1):
    conjunto.add(k)

print(tamanho[0]-len(conjunto))

Fixed submission:
tamanho=list(map(int,input().rstrip().split()))
intervalo=[1,tamanho[0]]

for i in range(tamanho[1]):
  iterando=list(map(int,input().rstrip().split()))
  intervalo[0]=max(intervalo[0],iterando[0])
  intervalo[1]=min(intervalo[1],iterando[1])

if intervalo[0]>intervalo[1]:
  print(0)
else:
  print(intervalo[1]-intervalo[0]+1)
Buggy python submission (verdict: Runtime Error):
S = input().strip()
listS = list(S)
listS.sort()
if listS[0] == listS[1] and listS[2] == listS[3] and listS[0] != listS[2] and l\
istS[1] != listS[3]:
    print("Yes")
else:
    print("No")

Fixed submission:
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 python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
 

lcm = C*D//math.gcd(C, D)

a_cnt = (A -1) - (((A - 1) // C) + ((A - 1) // D) - ((A - 1) // (lcm)))
b_cnt = B - ((B // C) + (B // D) - (B // (lcm)))

print(b_cnt - a_cnt)

Fixed submission:
import fractions
A,B,C,D = map(int,input().split())
 

lcm = C*D//fractions.gcd(C, D)

a_cnt = (A -1) - (((A - 1) // C) + ((A - 1) // D) - ((A - 1) // (lcm)))
b_cnt = B - ((B // C) + (B // D) - (B // (lcm)))

print(b_cnt - a_cnt)
Buggy python submission (verdict: Runtime Error):
s = input()

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

Fixed submission:
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 python submission (verdict: Runtime Error):
s = input()

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

Fixed submission:
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 python submission (verdict: Runtime Error):
list_a=[]
if len(list_a) !=AABB:
  print('ok')
else:
  print('no')

Fixed submission:
s=input()

if len(set(s))==2 and s.count(s[0])==2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    k = int(input())
    
    l = []
    for i in range(0, len(s)):
        for j in range(0, len(s)-i):
            sub = s[i:i+j+1]

            if sub not in l:
                l.append(sub)

    l.sort()
    
    print(l[k-1])

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s = input()
    k = int(input())
    
    l = []
    for i in range(0, len(s)):
        for j in range(0, min(len(s)-i, k)):
            sub = s[i:i+j+1]

            if sub not in l:
                l.append(sub)

    l.sort()
    
    print(l[k-1])

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    h, w = map(int, raw_input().split())

    square = []
    for i in range(h):
        square.append(raw_input())

    for i in range(h):
        for j in range(w):
            if square[i][j] == '.':
                continue
            else:
                if check(square, i, j, h, w):
                    continue
                else:
                    print("No")
                    exit()

    print("Yes")

def check(square, i, j, h, w):
    if i-1 >= 0:
        if square[i-1][j] == '#':
            return True
    if i+1 < h:
        if square[i+1][j] == '#':
            return True
    if j-1 >= 0:
        if square[i][j-1] == '#':
            return True
    if j+1 < w:
        if square[i][j+1] == '#':
            return True

    return False

if __name__ == '__main__':
    main()


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

def main():
    a, b = map(int, raw_input().split())

    if a <= b:
        print(a)
    else:
        print(a-1)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    h, w = map(int, raw_input().split())

    square = []
    for i in range(h):
        square.append(raw_input())

    for i in range(h):
        for j in range(w):
            if square[i][j] == '.':
                continue
            else:
                if check(square, i, j, h, w):
                    continue
                else:
                    print("No")
                    exit()

    print("Yes")

def check(square, i, j, h, w):
    if i-1 >= 0:
        if square[i-1][j] == '#':
            return True
    if i+1 < h:
        if square[i+1][j] == '#':
            return True
    if j-1 >= 0:
        if square[i][j-1] == '#':
            return True
    if j+1 < w:
        if square[i][j+1] == '#':
            return True

    return False

if __name__ == '__main__':
    main()


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

def main():
    a, b = map(int, raw_input().split())

    if a <= b:
        print(a)
    else:
        print(a-1)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    x = list(map(int, input().split()))


    for i in range(0, n):
        sort_list = x[:]
        sort_list.pop(i)
        sort_list.sort()
        print(sort_list[n//2-1])

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    x = list(map(int, input().split()))

    sort_list = x[:]
    sort_list.sort()

    for i in range(0, n):
        if x[i] < sort_list[n//2]:
            print(sort_list[n//2])
        else:
            print(sort_list[n//2 - 1])

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
 
L_sorted= L.sort()
 
target_num = N/2
if L_sorted[target_num-1] = L_sorted[target_num]:
	ans = 0
else:
  	ans= L_sorted[target_num]-L_sorted[target_num-1]

print(ans)

Fixed submission:
S = input()

if len(set(S)) == 2:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
if len(set(input()))==2:
  print('Yes')
else
  print('No')


Fixed submission:
S = input()

if len(set(S)) == 2:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
if len(set(input()))==2:
  print('Yes')
else
  print('No')


Fixed submission:
S = input()

if len(set(S)) == 2:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
if len(set(list(input())))==2:
  print('Yes')
else
  print('No')


Fixed submission:
S = input()

if len(set(S)) == 2:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
if set(list(input()))==2:
  print('Yes')
else
  print('No')

Fixed submission:
S = input()

if len(set(S)) == 2:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
if set(S) !== 2:
  print(No)

Fixed submission:
S = input()

if len(set(S)) == 2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
list = list(map(int,input().split()))

ans = 0
for i in range(N-2):
  if list[i+1] > List[i] and list[i+1] < List[i+2]:
    ans+=1
  if list[i+1] < List[i] and list[i+1] > List[i+2]:
    ans+=1
  else:
    pass

print(ans)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))

ans=0

for i in range(N-2):
  if L[i] < L[i+1] and  L[i+1] < L[i+2]:
    ans +=1 
  if L[i] > L[i+1] and  L[i+1] > L[i+2]:
    ans +=1 
  else:
    pass

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
list = list(map(int,input().split()))

ans = 0
for i in range(N-2):
  if list[i+1] > List[i] and list[i-1] < List[i]:
    ans+=1
  if list[i+1] < List[i] and list[i-1] > List[i]:
     ans+=1

print(ans)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))

ans=0

for i in range(N-2):
  if L[i] < L[i+1] and  L[i+1] < L[i+2]:
    ans +=1 
  if L[i] > L[i+1] and  L[i+1] > L[i+2]:
    ans +=1 
  else:
    pass

print(ans)