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

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

pairCounter=0
for i in range(N):
  if A[i] < 0:
    continue
  for b in range(9):
    pair=2**b - A[i]
    if pair < 1:
      continue
    #print(pair)
    if A.count(pair) >0:
      A[i] = -1
      A[A.index(pair)] = -1
      pairCounter+=1
      break

print(pairCounter)

Fixed submission:
from sys import stdin

def main():
    A=stdin.readline().replace('B', '0').replace('W', '1')
    #A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('1')
    indices = [i for i, x in enumerate(A) if x == '1']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin

def main():
    bw=stdin.readline().replace('B', '0').replace('W', '1')
    A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    A=[0,0,1]
    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()


Fixed submission:
from sys import stdin

def main():
    A=stdin.readline().replace('B', '0').replace('W', '1')
    #A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('1')
    indices = [i for i, x in enumerate(A) if x == '1']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin

def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    A=[0,0,1]
    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()


Fixed submission:
from sys import stdin

def main():
    A=stdin.readline().replace('B', '0').replace('W', '1')
    #A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('1')
    indices = [i for i, x in enumerate(A) if x == '1']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin

def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()


Fixed submission:
from sys import stdin

def main():
    A=stdin.readline().replace('B', '0').replace('W', '1')
    #A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('1')
    indices = [i for i, x in enumerate(A) if x == '1']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()


Fixed submission:
from sys import stdin

def main():
    A=stdin.readline().replace('B', '0').replace('W', '1')
    #A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('1')
    indices = [i for i, x in enumerate(A) if x == '1']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    print(sum(indices) - 1*wc*(wc-1) //2 )

input = lambda: stdin.readline()
main()


Fixed submission:
from sys import stdin

def main():
    A=stdin.readline().replace('B', '0').replace('W', '1')
    #A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('1')
    indices = [i for i, x in enumerate(A) if x == '1']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()