Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
l = input().split(" ")
w = int(l[0])
h = int(l[1])
n = int(l[2])

array = [[0 for i in range(h)] for j in range(w)]

for i in range(n):
	l = input().split(" ")
	x = int(l[0]) - 1
	y = int(l[1]) - 1
	for i in range(3):
		for j in range(3):
			if x+j-1 >=0 and x+j-1<w and y+i-1 >=0 and y+i-1<h:
				array[x+j-1][y+i-1] += 1

ans = [0 for i in range(10)]

for i in range(h-2):
	for j in range(w-2):
		ans[array[j+1][i+1]] += 1

for a in ans:
	print(a)

Fixed submission:
"""
l = input().split(" ")
w = int(l[0])
h = int(l[1])
n = int(l[2])

array = [[0 for i in range(h)] for j in range(w)]

for i in range(n):
	l = input().split(" ")
	x = int(l[0]) - 1
	y = int(l[1]) - 1
	for i in range(3):
		for j in range(3):
			if x+j-1 >=0 and x+j-1<w and y+i-1 >=0 and y+i-1<h:
				array[x+j-1][y+i-1] += 1

ans = [0 for i in range(10)]

for i in range(h-2):
	for j in range(w-2):
		ans[array[j+1][i+1]] += 1

for a in ans:
	print(a)

"""

l = input().split(" ")
w = int(l[0])
h = int(l[1])
n = int(l[2])

array = dict()

for i in range(n):
	l = input().split(" ")
	x = int(l[0])
	y = int(l[1])
	for i in range(3):
		if y-i < 1 or y-i > h-2:
			continue
		for j in range(3):
			if x-j < 1 or x-j > w-2:
				continue
			if (x-j, y-i) in array:
				array[(x-j, y-i)] +=1
			else:
				array[(x-j, y-i)] = 1

ans = [0] * 10
ans[0] = (h-2) * (w-2)
 
for i in array:
    ans[array[i]] += 1
    ans[0] -= 1

for i in range(10):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
l = input().split(" ")
w = int(l[0])
h = int(l[1])
n = int(l[2])

array = [[0 for i in range(h)] for j in range(w)]

for i in range(n):
	l = input().split(" ")
	x = int(l[0]) - 1
	y = int(l[1]) - 1
	array[x][y] = 1

ans = [0 for i in range(10)]

for i in range(h-2):
	for j in range(w-2):
		a = 0
		for y in range(3):
			for x in range(3):
				a += array[j+x][i+y]

		ans[a] += 1

for a in ans:
	print(a)

Fixed submission:
"""
l = input().split(" ")
w = int(l[0])
h = int(l[1])
n = int(l[2])

array = [[0 for i in range(h)] for j in range(w)]

for i in range(n):
	l = input().split(" ")
	x = int(l[0]) - 1
	y = int(l[1]) - 1
	for i in range(3):
		for j in range(3):
			if x+j-1 >=0 and x+j-1<w and y+i-1 >=0 and y+i-1<h:
				array[x+j-1][y+i-1] += 1

ans = [0 for i in range(10)]

for i in range(h-2):
	for j in range(w-2):
		ans[array[j+1][i+1]] += 1

for a in ans:
	print(a)

"""

l = input().split(" ")
w = int(l[0])
h = int(l[1])
n = int(l[2])

array = dict()

for i in range(n):
	l = input().split(" ")
	x = int(l[0])
	y = int(l[1])
	for i in range(3):
		if y-i < 1 or y-i > h-2:
			continue
		for j in range(3):
			if x-j < 1 or x-j > w-2:
				continue
			if (x-j, y-i) in array:
				array[(x-j, y-i)] +=1
			else:
				array[(x-j, y-i)] = 1

ans = [0] * 10
ans[0] = (h-2) * (w-2)
 
for i in array:
    ans[array[i]] += 1
    ans[0] -= 1

for i in range(10):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
class board:
    def __init__(self, h, w):
        self.h = h
        self.w = w
        self.pieces = self.make_pieces()
        self.results = dict()

    def make_pieces(self):
        pieces = []
        for i in range(self.h):
            for j in range(self.w):
                pieces.append(0)
        return pieces

    def draw(self, i, j):
        i -= 1; j-= 1

        index = j + i * self.w
        print(index)
        self.pieces[index] = 1

    def start_scan(self):
        for i in range(self.w - 2):
            print(i)
            for j in range(self.h - 2):
                print(j)
                num = 0
                for x in range(i, i+3):
                    for y in range(j, j+3):
                        index = x + y * self.w
                        v = self.pieces[index]
                        print("v = {0}".format(v))
                        if v == 1:
                            num += 1
                self.results[num] = num

    def searched_box(self, num):
        return self.results.get(num, 0)
        

if __name__ == '__main__':
    args = input().split(' ')
    board_h = int(args[0])
    board_w = int(args[1])
    n       = int(args[2])

    board = board(board_h, board_w)
    for _ in range(n):
        args = input().split(' ')
        i = int(args[0])
        j = int(args[1])
        board.draw(i, j)

    board.start_scan()
    for i in range(10):
        print(board.searched_box(i))


Fixed submission:
a = int(input())
b = int(input())
h = int(input())

s = ((a + b) * h ) / 2
print(int(s))
Buggy python submission (verdict: Runtime Error):
def SumIndicatedPoint(pcandid):
	point = list(str(pcandid))
	conNum = nums[0]
	count = 1
	sum = 0
	for p in point:
		if p == '0':
			conNum = conNum + nums[count]
		elif p == '1':
			sum = sum + int(conNum)
			conNum = nums[count]
		count = count + 1
	sum = sum + int(conNum)
	#print(str(sum))	
	return sum
	
if __name__ == '__main__':	
	nums = list(input())
	#nums.reverse()
	pcandidstr = '0' + str(len(nums) - 1) + 'b'
	pcandid = 0
	maxcandid = int('1' * (len(nums) - 1),2)
	#add = format(1,pcandidstr)
	ALLSUM = 0
	while pcandid <= maxcandid:
		ALLSUM = ALLSUM + SumIndicatedPoint(format(pcandid,pcandidstr))
		pcandid = pcandid + 1
	print(str(ALLSUM))

Fixed submission:
def SumIndicatedPoint(pcandid):
	point = list(str(pcandid))
	conNum = nums[0]
	count = 1
	sum = 0
	for p in point:
		if p == '0':
			conNum = conNum + nums[count]
		elif p == '1':
			sum = sum + int(conNum)
			conNum = nums[count]
		count = count + 1
	sum = sum + int(conNum)
	#print(str(sum))	
	return sum
	
if __name__ == '__main__':	
	nums = list(input())
	#nums.reverse()
	ALLSUM = 0
	pcandidstr = '0' + str(len(nums) - 1) + 'b'
	pcandid = 0
	if len(nums) > 1:
		maxcandid = int('1' * (len(nums) - 1),2)
		#add = format(1,pcandidstr)
		while pcandid <= maxcandid:
			ALLSUM = ALLSUM + SumIndicatedPoint(format(pcandid,pcandidstr))
			pcandid = pcandid + 1
	elif len(nums) == 1:
		ALLSUM = int(nums[0])
	print(str(ALLSUM))
Buggy python submission (verdict: Runtime Error):
s={}
for i in range(3):
    s[chr(97+i)]=input()
turn="a"
while True:
    if not s[turn]:
        break
    else:
        turn=s[turn][0]
        s[turn]=s[turn][1:]
print(turn.upper())


Fixed submission:
a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2)

Buggy python submission (verdict: Runtime Error):
s={}
for i in range(3):
    s[chr(97+i)]=input()
turn="a"
while True:
    if not s[turn]:
        break
    else:
        turn=s[turn][0]
        s[turn]=s[turn][1:]
print(turn.upper())


Fixed submission:
a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2)
Buggy python submission (verdict: Runtime Error):
s={}
for i in range(3):
    s[chr(97+i)]=input()
turn="a"
while True:
    if not s[turn]:
        break
    else:
        turn=s[turn[0]]
        s[turn]=s[turn][1:]
print(turn.upper())


Fixed submission:
s={}
for i in range(3):
    s[chr(97+i)]=input()
turn="a"
while True:
    if not s[turn]:
        break
    else:
        t=s[turn][0]
        s[turn]=s[turn][1:]
        turn=t
print(turn.upper())
Buggy python submission (verdict: Runtime Error):
dp=["","+"]
s=input()
su=0
for i in range(2**(len(s)-1)):
    val=""
    for j in range(len(s)-1):
        val+=s[j]
        val+=dp[int(bin(i)[j+2])]
    val+=s[len(s)-1]
    su+=eval(val)
print(su)


Fixed submission:
dp=["","+"]
s=input()
su=0
for i in range(2**(len(s)-1)):
    val=""
    b=bin(i)[2:].zfill(len(s)-1)
    for j in range(len(s)-1):
        val+=s[j]+dp[int(b[j])]
    val+=s[len(s)-1]
    su+=eval(val)
print(su)

Buggy python submission (verdict: Runtime Error):
dp=["","+"]
s=input()
su=0
for i in range(2**(len(s)-1)):
    val=""
    for j in range(len(s)-1):
        val+=s[j]
        val+=dp[bin(i)[j+2]]
    val+=s[len(s)-1]
    su+=eval(val)
print(su)

Fixed submission:
dp=["","+"]
s=input()
su=0
for i in range(2**(len(s)-1)):
    val=""
    b=bin(i)[2:].zfill(len(s)-1)
    for j in range(len(s)-1):
        val+=s[j]+dp[int(b[j])]
    val+=s[len(s)-1]
    su+=eval(val)
print(su)

Buggy python submission (verdict: Runtime Error):
dp=["","+"]
s=input()
su=0
for i in range(2**(len(s)-1)):
    val=""
    for j in range(len(s)-1):
        val+=s[j]+dp[bin(i)[j+2]]
    val+=s[len(s)-1]
    su+=eval(val)
print(su)

Fixed submission:
dp=["","+"]
s=input()
su=0
for i in range(2**(len(s)-1)):
    val=""
    b=bin(i)[2:].zfill(len(s)-1)
    for j in range(len(s)-1):
        val+=s[j]+dp[int(b[j])]
    val+=s[len(s)-1]
    su+=eval(val)
print(su)
Buggy python submission (verdict: Runtime Error):
s = input()
a = s.count("S") - s.count("N")
b = s.count("E") - s.count("W")
if (a == 0 && a == b):
 print ("Yes")
else:
 print ("No")


Fixed submission:
temp = input()
s = temp.count("S")
n = temp.count("N")
e = temp.count("E")
w = temp.count("W")

if (s == n):
 if (e>=1 & w >= 1):
  print ("Yes")
 else:
  print ("No")
elif (e == w):
 if (s >= 1 & n >= 1):
  print ("Yes")
 else:
  print ("No")
else:
 print ("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
 a.append(int(input()))
count = 0
for i in range(n):
 while (a[i] >= 2):
  a[i] -= 2
  count += 1
 if (i != n-1):
  while (a[i] >= 1 & a[i+1] >= 1):
   a[i] -= 1
   a[i+1] -= 1
   count += 1
print (count)

Fixed submission:
n = int(input())
a = []
for i in range(n):
 a.append(int(input()))
count = 0
for i in range(n):
 if (a[i] >= 2):
  count += int(a[i] / 2)
  a[i] = a[i] % 2
 if (i != n-1):
  if (a[i] >= a[i+1]):
   count += a[i+1]
   a[i] -= a[i+1]
   a[i+1] = 0
  else:
   count += a[i]
   a[i+1] -= a[i]
   a[i] = 0
print (count)
Buggy python submission (verdict: Runtime Error):
def main():
    ints = (int(_) for _ in input().split(' '))
    if any(_ % 2 == 0 for _ in ints):
        print(0)
        return
    t = max(ints)
    x, y, z = ints
    if t == x:
        print(y * z)
    elif t == y:
        print(x * z)
    elif t == z:
        print(x * y)


if __name__ == '__main__':
    main()


Fixed submission:
if __name__ == '__main__':
    x, y, z = (int(_) for _ in input().split(' '))
    a = max((x, y, z))
    if a == x:
        b, c = y, z
    elif a == y:
        b, c = x, z
    elif a == z:
        b, c = x, y
    print(abs(a // 2 * b * c - (a - a // 2) * b * c))

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    x, y, z = (int(_) for _ in input().split(' '))
    if x % 2 == 0 or y % 2 == 0 or z % 2 == 0:
        print(0)
        return
    t = max((x, y, z))
    if t == x:
        print(y * z)
    elif t == y:
        print(x * z)
    elif t == z:
        print(x * y)


Fixed submission:
if __name__ == '__main__':
    x, y, z = (int(_) for _ in input().split(' '))
    a = max((x, y, z))
    if a == x:
        b, c = y, z
    elif a == y:
        b, c = x, z
    elif a == z:
        b, c = x, y
    print(abs(a // 2 * b * c - (a - a // 2) * b * c))

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

if __name__ == '__main__':
    N, x = (int(_) for _ in input().split(' '))
    As = [int(_) for _ in input().split(' ')]
    each = sum(As)
    change = (N - 1) * x + N
    print(min(each, change))


Fixed submission:
if __name__ == '__main__':
    x, y, z = (int(_) for _ in input().split(' '))
    a = max((x, y, z))
    if a == x:
        b, c = y, z
    elif a == y:
        b, c = x, z
    elif a == z:
        b, c = x, y
    print(abs(a // 2 * b * c - (a - a // 2) * b * c))

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    x = int(input())
    y = int(input())
    z = int(input())
    lst = (x, y, z)

    a = max(lst)
    if a == x:
        b, c = y, z
    elif a == y:
        b, c = x, z
    elif a == z:
        b, c = x, y
    print(((a - (a // 2)) * b * c) - ((a // 2) * b * c))


Fixed submission:
if __name__ == '__main__':
    x, y, z = (int(_) for _ in input().split(' '))
    a = max((x, y, z))
    if a == x:
        b, c = y, z
    elif a == y:
        b, c = x, z
    elif a == z:
        b, c = x, y
    print(abs(a // 2 * b * c - (a - a // 2) * b * c))

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    x = int(input())
    y = int(input())
    z = int(input())
    t = (x, y, z)

    a = max(t)
    b, c =  [_ for _ in t if _ != a]
    print(((a - (a // 2)) * b * c) - ((a // 2) * b * c))


Fixed submission:
if __name__ == '__main__':
    x, y, z = (int(_) for _ in input().split(' '))
    a = max((x, y, z))
    if a == x:
        b, c = y, z
    elif a == y:
        b, c = x, z
    elif a == z:
        b, c = x, y
    print(abs(a // 2 * b * c - (a - a // 2) * b * c))
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

return x * n if n < k
return x * k + y * (n - k)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())

print( x * n if n < k else x * k + y * (n - k) )

Buggy python submission (verdict: Runtime Error):
n = input()
k = input()
x = input()
y = input()

return x * n if n < k
return x * k + y * (n - k)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())

print( x * n if n < k else x * k + y * (n - k) )
Buggy python submission (verdict: Runtime Error):

w = list(input())
w.sort()

isBeautiful = True
length = len(w)
for i in range(0, length, 2):
  if w[i] is not w[i + 1]:
    isBeautiful = False
    break

print('Yes' if isBeautiful else 'No')

Fixed submission:
# Hello World program in Python

def isBeautiful(w):
    w = list(w)
    length = len(w)
    
    if length % 2 != 0:
        return False
    
    w.sort()
    for i in range(0, length, 2):
      if w[i] != w[i + 1]:
        return False
    
    return True

w = input().strip()
 
print('Yes' if isBeautiful(w) else 'No')
Buggy python submission (verdict: Runtime Error):
target=input()
n = len(target)-1
bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)

Fixed submission:
import itertools

target=input()
n = len(target)-1
#bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
status = [['0', '1'] for _ in range(n)]
bit_list = list(itertools.product(*status)) 


answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
target=input()
n = len(target)-1
bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)

Fixed submission:
import itertools

target=input()
n = len(target)-1
#bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
status = [['0', '1'] for _ in range(n)]
bit_list = list(itertools.product(*status)) 


answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)
Buggy python submission (verdict: Runtime Error):
m, n = map(int,input().split())
l = map(str,input().split())
l2 = {str(i) for i in range(10)}
l3 = set(l2) - set(l)

ans = 0
for i in range(m, 100000):
    nums = set(str(i))
    if nums <= l3:
        print(i)
        break

Fixed submission:
a = list(map(int,input().split()))
if a.count(5) == 2 and a.count(7) == 1:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N=raw_input()

n=0

for i in range(0,N):
    n+=i

print n

Fixed submission:
N=int(raw_input())

n=0

for i in range(0,N+1):
    n+=i

print n
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
H, W, N = map(int, raw_input().split(' '))

T = Counter()

for _ in range(N):
    x, y = map(int, raw_input().split(' '))
    x -= 1
    y -= 1
    T[(x, y + 1)] += 1
    T[(x, y)] += 1
    T[(x, y - 1)] += 1
    T[(x-1,y+1)] += 1
    T[(x-1,y)] += 1
    T[(x-1,y-1)] += 1
    T[(x + 1, y + 1)] += 1
    T[(x + 1, y)] += 1
    T[(x + 1, y - 1)] += 1

ans = [0] * 10
total_points = H * W - (2 * H) - (2 * (W-2))
positive_points = 0
for (x, y), c in T.iteritems():
    if 0 < x < H-1 and 0 < y < W-1:
        ans[c] += 1
        positive_points += 1
ans[0] = total_points - positive_points

for i in range(10):
    print ans[i]

Fixed submission:
from collections import Counter
H, W, N = map(int, raw_input().split(' '))

T = Counter()

for _ in range(N):
    x, y = map(lambda _x: int(_x) - 1, raw_input().split(' '))
    T[(x, y + 1)] += 1
    T[(x, y)] += 1
    T[(x, y - 1)] += 1
    T[(x-1,y+1)] += 1
    T[(x-1,y)] += 1
    T[(x-1,y-1)] += 1
    T[(x + 1, y + 1)] += 1
    T[(x + 1, y)] += 1
    T[(x + 1, y - 1)] += 1

ans = [0] * 10
total_points = H * W - (2 * H) - (2 * (W-2))
positive_points = 0
for (x, y), c in T.iteritems():
    if 0 < x < H-1 and 0 < y < W-1:
        ans[c] += 1
        positive_points += 1
ans[0] = total_points - positive_points

for i in range(10):
    print ans[i]
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n=int(raw_input())
x=map(int,raw_input().split())+[float('inf')]
l=int(raw_input())
q=int(raw_input())
for i in xrange(q):
    a,b=map(int,raw_input().split())
    a-=1
    b-=1
    cnt=0
    if a<b:
        while a!=b:
            cnt+=1
            if x[a]+l==x[bisect.bisect_left(x,x[a]+l)]:
                a=bisect.bisect_left(x,x[a]+l)
            else:
                a=bisect.bisect_left(x,x[a]+l)-1
            if a>b:
                break
    else:
        while a!=b:
            cnt+=1
            if x[a]-l==x[bisect.bisect_left(x,x[a]-l)]:
                a=bisect.bisect_left(x,x[a]-l)
            else:
                a=bisect.bisect_left(x,x[a]-l)
            if a<b:
                break
    print(cnt)

Fixed submission:
import bisect

n=int(raw_input())
x=map(int,raw_input().split())+[float('inf')]
l=int(raw_input())
q=int(raw_input())
r=[[0]*20 for _ in xrange(n)]

for i in xrange(n):
    if x[i]+l==x[bisect.bisect_left(x,x[i]+l)]:
        r[i][0]=bisect.bisect_left(x,x[i]+l)
    else:
        r[i][0]=bisect.bisect_left(x,x[i]+l)-1

for k in xrange(19):
    for i in xrange(n):
        r[i][k+1]=r[r[i][k]][k]
        
for i in xrange(q):
    a,b=map(int,raw_input().split())
    a-=1
    b-=1
    ans=0
    if a>b:
        a,b=b,a
    while 1:
        if bisect.bisect_left(r[a],b)>=1:
            ans+=1<<(bisect.bisect_left(r[a],b)-1)
            a=r[a][bisect.bisect_left(r[a],b)-1]
        else :
            ans+=1<<bisect.bisect_left(r[a],b)
            break
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n=int(raw_input())
x=map(int,raw_input().split())
l=int(raw_input())
q=int(raw_input())
for i in xrange(q):
    a,b=map(int,raw_input().split())
    a-=1
    b-=1
    cnt=0
    if a<b:
        while a!=b:
            cnt+=1
            if x[a]+l==x[bisect.bisect_left(x,x[a]+l)]:
                a=bisect.bisect_left(x,x[a]+l)
            else:
                a=bisect.bisect_left(x,x[a]+l)-1
            if a>b:
                break
    else:
        while a!=b:
            cnt+=1
            if x[a]-l==x[bisect.bisect_left(x,x[a]-l)]:
                a=bisect.bisect_left(x,x[a]-l)
            else:
                a=bisect.bisect_left(x,x[a]-l)
            if a<b:
                break
    print(cnt)



Fixed submission:
import bisect

n=int(raw_input())
x=map(int,raw_input().split())+[float('inf')]
l=int(raw_input())
q=int(raw_input())
r=[[0]*20 for _ in xrange(n)]

for i in xrange(n):
    if x[i]+l==x[bisect.bisect_left(x,x[i]+l)]:
        r[i][0]=bisect.bisect_left(x,x[i]+l)
    else:
        r[i][0]=bisect.bisect_left(x,x[i]+l)-1

for k in xrange(19):
    for i in xrange(n):
        r[i][k+1]=r[r[i][k]][k]
        
for i in xrange(q):
    a,b=map(int,raw_input().split())
    a-=1
    b-=1
    ans=0
    if a>b:
        a,b=b,a
    while 1:
        if bisect.bisect_left(r[a],b)>=1:
            ans+=1<<(bisect.bisect_left(r[a],b)-1)
            a=r[a][bisect.bisect_left(r[a],b)-1]
        else :
            ans+=1<<bisect.bisect_left(r[a],b)
            break
    print(ans)
Buggy python submission (verdict: Runtime Error):
s=raw_input()
n=len(s)
cnt=[[0]*26 for _ in xrange(n+1)]
for i in xrange(n):
    for j in xrange(26):
        cnt[i+1][j]=cnt[i][j]
    cnt[i+1][ord(s[i])-ord("a")]+=1
if n==2:
    if s[0]==s[1]:
        print 1,2
        quit()
    else:
        print -1,-1
        quit()
for i in xrange(n):
    for j in xrange(i+3,n+1):
        max_cnt=0
        for k in xrange(26):
            max_cnt=max(max_cnt,cnt[j][k]-cnt[i][k])
        if (j-i)/2<max_cnt:
            print i+1,j
            quit()
print -1,-1

Fixed submission:
n=input()
a=map(int,raw_input().split())
ans=10**9
for j in xrange(-100,101):
    asum=0
    for i in xrange(n):
        asum+=(a[i]-j)**2
    ans=min(ans,asum)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=raw_input()
n=len(s)
cnt=[[0]*26 for _ in xrange(n+1)]
for i in xrange(n):
    for j in xrange(26):
        cnt[i+1][j]=cnt[i][j]
    cnt[i+1][ord(s[i])-ord("a")]+=1
if n==2:
    if s[0]==s[1]:
        print 1,2
        quit()
    else:
        print -1,-1
        quit()
for i in xrange(n):
    for j in xrange(i+3,n+1):
        max_cnt=0
        for k in xrange(26):
            max_cnt=max(max_cnt,cnt[j][k]-cnt[i][k])
        if (j-i)/2<max_cnt:
            print i+1,j
            quit()
print -1,-1

Fixed submission:
s=raw_input()
n=len(s)
if n==2:
    if s[0]==s[1]:
        print 1,2
        quit()
    else:
        print -1,-1
        quit()
for i in xrange(n-2):
    if s[i]==s[i+1] or s[i]==s[i+2] or s[i+1]==s[i+2]:
        print i+1,i+3
        quit()
print -1,-1
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

def dfs1(s,c):
    visited[s]=1
    for i in v[s]:
        if visited[i]==0:
            d[c][i]=d[c][s]+1
            dfs1(i,c)
    return

def dfs2(c1,c2):
    visited[c2]=1
    dfs1(c1,c1)
    dfs1(c2,c2)
    return

n,k=map(int,raw_input().split())
d=[[0]*n for _ in xrange(n)]
v=[[] for _ in xrange(n)]
e=[]
for i in xrange(n-1):
    a,b=map(int,raw_input().split())
    a-=1
    b-=1
    v[a].append(b)
    v[b].append(a)
    e.append([a,b])
if k%2==0:
    min_del=1000000
    for i in xrange(n):
        cnt=0
        visited=[0]*n
        dfs1(i,i)
        for j in xrange(n):
            if d[i][j]>k/2:
                cnt+=1
        min_del=min(min_del,cnt)
    print(min_del)
else:
    min_del=1000000
    for i,j in e:
        cnt=0
        visited=[0]*n
        d=[[0]*n for _ in xrange(n)]
        dfs2(i,j)
        for l in xrange(n):
            if d[i][l]>(k-1)/2 or d[j][l]>(k-1)/2:
                cnt+=1
        min_del=min(min_del,cnt)
    print(min_del)

Fixed submission:
n=input()
l=map(int,raw_input().split())
l.sort()
cnt=0
for i in xrange(n):
    cnt+=l[i*2]
print(cnt)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
iroha=[a,b,c]

if iroha.count(2)==5 and iroha.count(1)==7:
  print("YES")
else:
  prnt("NO")

Fixed submission:
a, b, c = map(int, input().split())
iroha = [a, b, c]
if iroha.count(5) == 2 and iroha.count(7) == 1:
  print("YES")
else:
  print("NO")