Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

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

Fixed submission:
a,b,c = map(int,input().split())

if a+b == c:
    print("Yes")
elif a+c == b:
    print("Yes")
elif a == b+c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().strip())
b = a[0] #色の数
c = a[1] #ボールの数

ans  = (b*(b-1)**(c-1))
print(ans)

Fixed submission:
x = list(map(int,input().split()))
a = x[0]
b = x[1]
print(b*((b-1) ** (a-1)))
Buggy python submission (verdict: Runtime Error):
a = list(input())
b = list(input())
c = list(input())
x = "d"
a_idx = 0
b_idx = 0
c_idx = 0
while True:
    if x == "a":
        if a_idx == len(a):
            print("A")
            break
        else:
            x = str(a[a_idx])
            a_idx += 1
    elif x == "b":
        if b_idx == len(b):
            print(B)
            break
        else:
            x = str(b[b_idx])
            b_idx += 1
    elif x == "c":
        if c_idx == len(c):
            print("C")
            break
        else:
            x = str(c[c_idx])
            c_idx += 1
    else:
        x = "a"

Fixed submission:
s=[input() for i in range(3)]
l=[len(s[i]) for i in range(3)]
abc=[0,0,0]
now=0
while abc[now]!=l[now]:
    s_sub=s[now][abc[now]]
    abc[now]+=1
    now=(0 if s_sub=="a" else 1 if s_sub=="b" else 2)
print("A" if now==0 else "B" if now==1 else "C")

Buggy python submission (verdict: Runtime Error):
a = list(input())
b = list(input())
c = list(input())
x = "d"
a_idx = 0
b_idx = 0
c_idx = 0
while a_idx != len(a) -1 and b_idx != len(b) -1 and c_idx != len(c) -1:
    if x == "a":
        x = str(a[a_idx])
        a_idx += 1
    elif x == "b":
        x = str(b[b_idx])
        b_odx += 1
    elif x == "c":
        x = str(c[c_idx])
        c_idx += 1
    else:
        x = "a"
if a_idx == len(a) -1 :
    print("A")
elif b_idx == len(b)-1:
    print("B")
else:
    print("C")

Fixed submission:
s=[input() for i in range(3)]
l=[len(s[i]) for i in range(3)]
abc=[0,0,0]
now=0
while abc[now]!=l[now]:
    s_sub=s[now][abc[now]]
    abc[now]+=1
    now=(0 if s_sub=="a" else 1 if s_sub=="b" else 2)
print("A" if now==0 else "B" if now==1 else "C")
Buggy python submission (verdict: Runtime Error):
def dfs(i,f):
    if i == n-1:
        return sum(list(map(int,input().split("+"))))
    return dfs(i+1,f+s[i+1]) + dfs[i+1,f + "+" + s[i+1]]

s = input()
n = len(s)
print(dfs(0,s[0]))

Fixed submission:
s = input()
l = len(s)

ans = 0
for i in range(2 ** (l -1)):
    ans_sub = 0
    subst = s[0]
    for j in range(l-1):
        if(i>>j)&1:
            ans_sub += int(subst)
            subst = s[j+1]
        else:
            subst += s[j+1]
        if j ==l-2:
            ans_sub += int(subst)
    ans += ans_sub
if l == 1:
    print(int(s))
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = 0

for i in range(1,a+1):
  if i >= b+1:
    e += d
    else:
      e += c
      print(e)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = 0

for i in range(1,a+1):
  if i >= b+1:
    e += d
  else:
    e += c
print(e)
Buggy python submission (verdict: Runtime Error):
a = list(input())
even_number = range(0,101,2)
values,count = *zip(a.most_common())

if even_number in count:
  print("Yes")
else:
  print("No")



Fixed submission:
a = list(input())
even_number = [x for x in range(0,101,2)]
tmp_list = []
tmp_set = set(a)

tmp_list = [a.count(x) for x in tmp_set]
if all(x % 2 == 0 for x in tmp_list) == True:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = list(input())
b = []
for i in a:
    if a.count(i) >= len(a)/2:
        b = [j for j ,x in enumerate(a) if x == i]
    else:
        pass
if not b:
  print(-1,1)
else:
  print(b[0],b[1])

Fixed submission:
a = int(input())
b = 0
for i in range(a+1):
    b += int(i)
print(b)
Buggy python submission (verdict: Runtime Error):
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[i-1]
        
print("".join(b))

Fixed submission:
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[len(b)-1]
        
print("".join(b))

Buggy python submission (verdict: Runtime Error):
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if a[0] == str("B"):
            pass
        else:
            del b[i-1]
        
print("".join(b))

Fixed submission:
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[len(b)-1]
        
print("".join(b))

Buggy python submission (verdict: Runtime Error):
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    else:
        del b[i-1]
print("".join(b))
        

Fixed submission:
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[len(b)-1]
        
print("".join(b))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = list(map(int,input().split()))
c = int(input())
d = 0

for i in b:
    d += (int(i) - int(c)) ** 2
print(d)

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
ans = 4000000

for i in range(-100,101):
    ans_sub = 0
    for j in range(a):
        ans_sub += (b[j]-i)**2
    ans = min(ans,ans_sub)
print(ans)
Buggy python submission (verdict: Runtime Error):
from sys import stdin

A,B,C = [int(x) for x in stdin.realine().rstrip().split()]

if A+B+C == 17 and A>=5 and B>=5 and C>=5:
  print("YES")
else:
  print("NO")
  

Fixed submission:
from sys import stdin

A,B,C = [int(x) for x in stdin.readline().rstrip().split()]

if A + B + C == 17 and A >= 5 and B >= 5 and C >= 5:
        print("YES")
else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())

if A+B+C == 17 and A >= 5 and B >= 5 and C >= 5:
  print("YES")
else:
  print("NO")

Fixed submission:
from sys import stdin

A,B,C = [int(x) for x in stdin.readline().rstrip().split()]

if A + B + C == 17 and A >= 5 and B >= 5 and C >= 5:
        print("YES")
else:
        print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lst=list(map(int,input().strip().split()))
s=0
mod=1000000007
for i in range(0,n):
    for j in range(i+1,n):
        s+=(((lst[i]%mod)*(lst[j]%mod))%mod)
print(s%mod)

Fixed submission:
n=int(input())
lst=list(map(int,input().strip().split()))
s1=sum(lst)
num=s1*s1
denom=0 
mod=1000000007
for i in range(0,n):
        denom+=(lst[i]*lst[i])
print(((num-denom)//2)%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lst=list(map(int,input().strip().split()))
s=0
mod=1000000007
for i in range(0,n):
    for j in range(i+1,n):
        s+=((lst[i]*lst[j])%mod)
print(s%mod)

Fixed submission:
n=int(input())
lst=list(map(int,input().strip().split()))
s1=sum(lst)
num=s1*s1
denom=0 
mod=1000000007
for i in range(0,n):
        denom+=(lst[i]*lst[i])
print(((num-denom)//2)%mod)
Buggy python submission (verdict: Runtime Error):
n=int(input())
lst=list(map(int,input().strip().split()))[:n]
print(findnumberofTriangles(lst))
count=0 
for i in range(0,n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if(lst[i]!=lst[j] and lst[j]!=lst[k] and lst[k]!=lst[i]):
                if (lst[i] +lst[j] > lst[k] and 
                    lst[i] + lst[k] > lst[j] and 
                    lst[k] + lst[j] > lst[i]): 
                    count += 1
print(count)

Fixed submission:
n=int(input())
lst=list(map(int,input().strip().split()))[:n]
count=0 
for i in range(0,n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if(lst[i]!=lst[j] and lst[j]!=lst[k] and lst[k]!=lst[i]):
                if (lst[i] +lst[j] > lst[k] and 
                    lst[i] + lst[k] > lst[j] and 
                    lst[k] + lst[j] > lst[i]): 
                    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
if(n%2==0):
    print(-1)
else:
    a=7 
    ans=1
    flag=1  
    while(flag):
        if(a%n==0):
            print(ans)
            flag=0
            break 
        else:
            ans+=1 
            s=str(a)
            s1='7'
            s2=int(s+s1)
            a=int(s2)
            
         


Fixed submission:
n=int(input())
if(n%2==0 or n%5==0):
    print(-1)
else:
    a=7 
    ans=1
    flag=1  
    while(flag):
        if(a%n==0):
            print(ans)
            flag=0
            break 
        else:
            ans+=1 
            s=str(a)
            s1='7'
            s2=int(s+s1)
            a=(int(s2))%n
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = []
alpha = "abcdefghijklmnopqrstuvwxyz"
d = {i+1: a for i, a in enumerate(alpha)}
while N != 0:
    l.append(N % 26)
    N = N // 26
ans = []
for i in l[::-1]:
    ans.append(d[i])
print("".join(ans))

Fixed submission:
N = int(input())

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

print(num2alpha(N).lower())
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

maxA = max(A)
maxl = len(bin(maxA)[2:])
binary_c = [0 for _ in range(maxl)]
for a in A:
    for i, n in enumerate(bin(a)[2:].zfill(maxl)):
        if n == "1":
            binary_c[i] += 1
is_inv = []
for bc in binary_c:
    if bc % 2 == 0:
        is_inv.append(False)
    else:
        is_inv.append(True)

for a in A:
    l = []
    for i, n in enumerate(bin(a)[2:].zfill(maxl)):
        if is_inv[i]:
            if n == "0":
                l.append("1")
            else:
                l.append("0")
        else:
            l.append(n)
    print(int("".join(l), 2))


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

maxA = max(A)
maxl = len(bin(maxA)[2:])
binary_c = [0 for _ in range(maxl)]
A_binary = [bin(a)[2:].zfill(maxl) for a in A]
for a in A_binary:
    for i, n in enumerate(a):
        if n == "1":
            binary_c[i] += 1
is_inv = []
for bc in binary_c:
    if bc % 2 == 0:
        is_inv.append(False)
    else:
        is_inv.append(True)

for a in A_binary:
    l = []
    for i, n in enumerate(a):
        if is_inv[i]:
            if n == "0":
                l.append("1")
            else:
                l.append("0")
        else:
            l.append(n)
    print(int("".join(l), 2))
Buggy python submission (verdict: Time Limit Exceeded):
from  collections import deque
K = int(input())
# 素因数分解
# 戻り値: リスト
def prime_factor(n):
    ass = deque
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

# 最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

ans = 0
d = {}
for a in range(1, K+1):
    for b in range(1, K+1):
        t = (a, b)
        d[t] = gcd(a, b)
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            ab = d[(a, b)]
            ans += d[(ab, c)]
print(ans)

Fixed submission:
from  collections import deque
K = int(input())
# 素因数分解
# 戻り値: リスト
def prime_factor(n):
    ass = deque
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

# 最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

ans = 0
d = {}
for a in range(1, K+1):
    for b in range(1, K+1):
        t = (a, b)
        d[t] = gcd(a, b)
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            ab = d[(a, b)]
            ans += d[(ab, c)]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from decimal import *
getcontext().prec = 40000
a, b, c = map(int, input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
    print("Yes")
else:
    print("No")

Fixed submission:
from decimal import *
getcontext().prec = 30000
a, b, c = map(int, input().split())
# if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
if a + b + 2 * Decimal(a * b).sqrt() < c: 
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
S = [input()]
Q = int(input())
querys = [input() for _ in range(Q)]
is_reverse = False

for q in querys:
    query = q.split()
    if len(query) == 1:
        is_reverse = not is_reverse
        continue
    _, f, c = query
    if is_reverse:
        
        if f == "1":
            S = S + [c]
        elif f == "2":
            S = [c] + S
    else:
        if f == "1":
            S = [c] + S
        elif f == "2":
            S = S + [c]
if is_reverse:
    print("".join(S)[::-1])
else:
    print("".join(S))


Fixed submission:
from collections import deque
S = input()
Q = int(input())
querys = [input() for _ in range(Q)]
is_reverse = False
d = deque([S])

for q in querys:
    query = q.split()
    if len(query) == 1:
        is_reverse = not is_reverse
        continue
    _, f, c = query
    if is_reverse:
        
        if f == "1":
            d.append(c)
        elif f == "2":
            d.appendleft(c)
    else:
        if f == "1":
            d.appendleft(c)
        elif f == "2":
            d.append(c)
if is_reverse:
    print("".join(d)[::-1])
else:
    print("".join(d))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
querys = [input() for _ in range(Q)]
is_reverse = False

for q in querys:
    query = q.split()
    if len(query) == 1:
        is_reverse = not is_reverse
        continue
    _, f, c = query
    if is_reverse:
        
        if f == "1":
            S = S + c
        elif f == "2":
            S = c + S
    else:
        if f == "1":
            S = c + S
        elif f == "2":
            S = S + c
if is_reverse:
    print(S[::-1])
else:
    print(S)

Fixed submission:
from collections import deque
S = input()
Q = int(input())
querys = [input() for _ in range(Q)]
is_reverse = False
d = deque([S])

for q in querys:
    query = q.split()
    if len(query) == 1:
        is_reverse = not is_reverse
        continue
    _, f, c = query
    if is_reverse:
        
        if f == "1":
            d.append(c)
        elif f == "2":
            d.appendleft(c)
    else:
        if f == "1":
            d.appendleft(c)
        elif f == "2":
            d.append(c)
if is_reverse:
    print("".join(d)[::-1])
else:
    print("".join(d))
Buggy python submission (verdict: Runtime Error):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    A -= 1
elif T == U:
    B -= 1
print(f"{A} {B}")

Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    A -= 1
elif T == U:
    B -= 1
print("{} {}".format(A, B))

Buggy python submission (verdict: Runtime Error):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    A -= 1
elif T == U:
    B -= 1
print(f"{A} {B}")

Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    A -= 1
elif T == U:
    B -= 1
print("{} {}".format(A, B))
Buggy python submission (verdict: Runtime Error):
N = int(input())
V = list(map(int, input().split()))
V.sorted()

ans = (V[0] + V[1]) / 2
for i in range(2, len(V) - 1)::
    ans = (ans + V[i]) / 2
print(ans)
  

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

ans = (V[0] + V[1]) / 2
for i in range(2, len(V)):
    ans = (ans + V[i]) / 2
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
n = [i+1 in range(N)]
c = 0
for i in range(N):
  if n[i] != p[i]:
    c += 1
if c == 0 or c == 2:
  print("YES")
else:
  print("NO")
	

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
n = [i+1 for i in range(N)]
c = 0
for i in range(N):
    if n[i] != p[i]:
        c += 1
if c == 0 or c == 2:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
if N == 1:
    print(1)
    exit()
xy.sort(key = lambda x:x[0])
d = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        tmp = (xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
        if not tmp in d:
            d[tmp] = 0
        d[tmp] += 1
        #print(xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
    #print()
d = sorted(d.items(), key = lambda x:-x[1])
print(N - d[0][1])

Fixed submission:
N, K = map(int, input().split())
print(N%K)
Buggy python submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xy.sort(key = lambda x:x[0])
d = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        tmp = (xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
        if not tmp in d:
            d[tmp] = 0
        d[tmp] += 1
        #print(xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
    #print()
d = sorted(d.items(), key = lambda x:-x[1])
print(N - d[0][1])


Fixed submission:
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
if N == 1:
    print(1)
    exit()
xy.sort(key = lambda x:x[0])
d = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        tmp = (xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
        if not tmp in d:
            d[tmp] = 0
        d[tmp] += 1
        #print(xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
    #print()
d = sorted(d.items(), key = lambda x:-x[1])
print(N - d[0][1])
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
r = [[0 for _ in range(W)] for _ in range(H)]
l = [[0 for _ in range(W)] for _ in range(H)]
d = [[0 for _ in range(W)] for _ in range(H)]
u = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    c = 0
    for j in range(W):
        if S[i][j] == ".":
            r[i][j] = c
            c += 1
        else:
            c = 0
for i in range(H):
    c = 0
    for j in range(W)[::-1]:
        if S[i][j] == ".":
            c += 1
            l[i][j] = c
        else:
            c = 0
for i in range(W):
    c = 0
    for j in range(H):
        if S[j][i] == ".":
            d[j][i] = c
            c += 1
        else:
            c = 0
for i in range(W):
    c = 0
    for j in range(H)[::-1]:
        if S[j][i] == ".":
            c += 1
            u[j][i] = c
        else:
            c = 0
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, r[i][j] + l[i][j] + d[i][j] + u[i][j] - 1)
print(ans)

Fixed submission:
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
r = [[0 for _ in range(W)] for _ in range(H)]
l = [[0 for _ in range(W)] for _ in range(H)]
d = [[0 for _ in range(W)] for _ in range(H)]
u = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    c = 0
    for j in range(W):
        if S[i][j] == ".":
            r[i][j] = c
            c += 1
        else:
            c = 0
for i in range(H):
    c = 0
    for j in range(W)[::-1]:
        if S[i][j] == ".":
            c += 1
            l[i][j] = c
        else:
            c = 0
for i in range(W):
    c = 0
    for j in range(H):
        if S[j][i] == ".":
            d[j][i] = c
            c += 1
        else:
            c = 0
for i in range(W):
    c = 0
    for j in range(H)[::-1]:
        if S[j][i] == ".":
            c += 1
            u[j][i] = c
        else:
            c = 0
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, r[i][j] + l[i][j] + d[i][j] + u[i][j] - 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
A.sort()
BC.sort(key = lambda x:-x[1])
i = 0
for b, c in BC:
    for j in range(b):
            if A[i] < c:
                A[i] = c
                i += 1
            else:
                break
print(sum(A))


Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
A.sort()
BC.sort(key = lambda x:-x[1])
i = 0
for b, c in BC:
    for j in range(b):
        if A[i] < c:
            A[i] = c
            i += 1
        else:
            break
        if i >= N:
            break
    if i >= N:
        break
print(sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int,  input().split())
ans = 0
for i in range(3000 // R + 1):
    for j in range(3000 // G + 1):
        tmp = (N - i * R - j * G)
        if tmp % B == 0 and tmp >= 0:
            ans += 1
print(ans)


Fixed submission:
R, G, B, N = map(int,  input().split())
ans = 0
for i in range(3000 // R + 1):
    for j in range(3000 // G + 1):
        tmp = (N - i * R - j * G)
        if tmp % B == 0 and tmp >= 0:
            ans += 1
        elif tmp < 0:
            break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
s = list(input())
queue = deque()
res = 0
count = 0
for c in s:
    queue.append(c)
    count += 1
    if count >= 2:
        if "0" == queue[-1] and "1" == list(queue)[-2] or "0" == queue[-2] and "1" == list(queue)[-1]:
             res += 2
             count -= 2 
             queue.pop()
             queue.pop()
print(res)

Fixed submission:
from collections import deque
s = list(input())
queue = deque()
res = 0
count = 0
for c in s:
    queue.append(c)
    count += 1
    if count >= 2:
        if "0" == queue[-1] and "1" == queue[-2] or "0" == queue[-2] and "1" == queue[-1]:
             res += 2
             count -= 2
             queue.pop()
             queue.pop()
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
s = list(input())
queue = deque()
res = 0
for c in s:
    queue.append(c)
    if len(queue) >= 2:
        if "0" in list(queue)[-2:] and "1" in list(queue)[-2:]:
             res += 2
             queue.pop()
             queue.pop()
print(res)


Fixed submission:
from collections import deque
s = list(input())
queue = deque()
res = 0
count = 0
for c in s:
    queue.append(c)
    count += 1
    if count >= 2:
        if "0" == queue[-1] and "1" == queue[-2] or "0" == queue[-2] and "1" == queue[-1]:
             res += 2
             count -= 2
             queue.pop()
             queue.pop()
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
ans = 1e11
for i in range(0, n-k+1):
    maxh = max(h[i:i+k])
    minh = min(h[i:i+k])
    if ans > maxh - minh:
        ans = maxh - minh
print(ans)

Fixed submission:
n, k = map(int, input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort(reverse = True)
ans = 10000000000
maxh = h[:k]
maxn = 0
for i in range(k, n):
    if ans > maxh[maxn] - maxh[(maxn-1)%k]:
        ans = maxh[maxn] - maxh[(maxn-1)%k]
    maxh[maxn] = h[i]
    maxn = (maxn+1) % k
if ans > maxh[maxn] - maxh[(maxn-1)%k]:
    ans = maxh[maxn] - maxh[(maxn-1)%k]
print(ans)