Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = map(int, input().split())
b = []

for index, value in enumerate(a):
    if index % 2 == 0:
        b = [value] + b
    else:
        b = b + [value]
if n % 2 == 0:
    b = reversed(b)
print(" ".join(map(str, b)))

Fixed submission:
from collections import deque

n = int(input())
a = map(int, input().split())
b = deque([])

for index, value in enumerate(a):
    if index % 2 == 0:
        b.appendleft(value)
    else:
        b.append(value)
if n % 2 == 0:
    b = reversed(b)
print(" ".join(map(str, b)))
Buggy python submission (verdict: Runtime Error):
import itertools

def sign(num):
    if num < 0:
        return -1
    elif num > 0:
        return 1
    else:
        return 0

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

signs = [-1,1]
a_sum = 0
changes_1 = 0
for i, a in enumerate(a_i):
    a_sum += a
    if sign(a_sum) != signs[i%2]:
        changes_1 += abs(a_sum) + 1
        a_sum = signs[i%2]

signs = [1,-1]
a_sum = 0
changes_2 = 0
for i, a in enumerate(a_i):
    a_sum += a
    if sign(a_sum) != signs[i%2]:
        changes_2 += abs(a_sum) + 1
        a_sum = signs[i%2]

print(min(changes_1,changes_2))

Fixed submission:
S = input()
out = ""
for s in S.split():
    out += s[0].upper()
print(out)

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

def sign(num):
    if num < 0:
        return -1
    elif num > 0:
        return 1
    else:
        return 0

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

# a_sum = [a_i[0]]
# for i, a in enumerate(a_i[1:]):
#     i += 1
#     a_sum.append(a_sum[-1]+a)
#
# signs = [1, -1]
# changes = 0
#
# for i, sum_i in enumerate(a_sum):
#     if sum_i != 0:
#         signs[i%2] = sign(sum_i)
#         signs[i%2+1] = -sign(sum_i)
#         break

signs = [sign(a_i[0]), -sign(a_i[0])]

a_sum = 0
changes = 0
for i, a in enumerate(a_i):
    a_sum += a
    if sign(a_sum) != signs[i%2]:
        changes += abs(a_sum) + 1
        a_sum = signs[i%2]
print(changes)

#
# for i, sum_i in enumerate(a_sum):
#     if i == 0:
#         signs = [sign(sum_i), -sign(sum_i)]
#     elif sign(sum_i) != signs[i%2]:
#         a_sum[i:] = [num + (abs(sum_i) + 1) * signs[i%2] for num in a_sum[i:]]
#         changes += abs(sum_i) + 1
#     # print(a_sum)
# print(changes)


Fixed submission:
S = input()
out = ""
for s in S.split():
    out += s[0].upper()
print(out)
Buggy python submission (verdict: Runtime Error):
n = int(input())
alphabet_histgram = [[0 for _ in range(n)] for _ in range(25)]
ord_a = ord("a")

for i in range(n):
    S = input()
    for c in S:
        alphabet_histgram[ord(c) - ord_a][i] += 1

ret = ""
for i, hist_c in enumerate(alphabet_histgram):
    ret += chr(ord_a + i) * min(hist_c)

print(ret)


Fixed submission:
n = int(input())
alphabet_histgram = [[0 for _ in range(n)] for _ in range(26)]
ord_a = ord("a")

for i in range(n):
    S = input()
    for c in S:
        alphabet_histgram[ord(c) - ord_a][i] += 1

ret = ""
for i, hist_c in enumerate(alphabet_histgram):
    ret += chr(ord_a + i) * min(hist_c)

print(ret)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, a, b = map(int, raw_input().split())
h = []
for i in xrange(n):
    h.append(int(raw_input()))
h = np.array(h)
count = 0
adiff = a - b
while(1):
    h = h - b
    h[np.argmax(h)] -= adiff
    count += 1
    if all(h <= 0):
        break
print count


Fixed submission:
import numpy as np
n, a, b = map(int, raw_input().split())
h = []
for i in xrange(n):
    h.append(int(raw_input()))
h = np.array(h)
count = 0
adiff = float(a - b)
top = max(h) / b + 1
bottom = 0
mid = top / 2
while(1):
    if top - bottom < 2:
        break
    hmem = h - b * mid
    if np.sum(np.ceil(hmem[hmem > 0] / adiff)) <= mid:
        top = mid
    else:
        bottom = mid
    mid = (top + bottom) / 2
print top
Buggy python submission (verdict: Runtime Error):
# Bellman-Ford
n, m = map(int, raw_bellman-input().split())
a, b, c = [], [], []
for i in xrange(m):
    at, bt, ct = map(int, raw_input().split())
    a.append(at - 1)
    b.append(bt - 1)
    c.append(ct)
# step1 : initialize
point = [-1e9 * m - 1] * n
point[0] = 0
pointl = [None] * n
# step2 : relaxation
for i in xrange(n-1):
    for j in xrange(m):
        if point[b[j]] < point[a[j]] + c[j]:
            point[b[j]] = point[a[j]] + c[j]
            pointl[b[j]] = a[j]
        print point
# step3 : check
flag = True
for j in xrange(m):
    if point[a[j]] + c[j] > point[b[j]]:
        flag = False
        break
if flag:
    print(point[n-1])
else:
    print("inf")
    


Fixed submission:
# Bellman-Ford
n, m = map(int, raw_input().split())
a, b, c = [], [], []
for i in xrange(m):
    at, bt, ct = map(int, raw_input().split())
    a.append(at - 1)
    b.append(bt - 1)
    c.append(ct)
# step1 : initialize
point = [-1e9 * m - 1] * n
point[0] = 0
# step2 : relaxation
for i in xrange(n+1):
    for j in xrange(m):
        if point[b[j]] < point[a[j]] + c[j]:
            point[b[j]] = point[a[j]] + c[j]
# step3 : check
looped = [False] * n
for i in xrange(n):
    for j in xrange(m):
        if point[b[j]] < point[a[j]] + c[j]:
            looped[b[j]] = True
        if looped[a[j]] == True:
            looped[b[j]] = True
if looped[n-1]:
    print("inf")
else:
    print(point[n-1])
Buggy python submission (verdict: Runtime Error):
w, h = map(int, raw_input().split())
p = []
q = []
for i in xrange(w):
    p.append(int(raw_input()))
for i in xrange(h):
    q.append(int(raw_input()))

wl = w
hl = h

cost = 0

p.sort()
q.sort()

p.append(10 ** 8)
q.append(10 ** 8)

pc = 0
qc = 0

while(wl + hl - pc - qc> 0):
    if p[pc] < q[qc]:
        cost += (hl - qc + 1) * p[pc]
        pc += 1
    else:
        cost += (wl - pc + 1) * q[qc]
        qc += 1

print cost



Fixed submission:
s = raw_input()
st = "CODEFESTIVAL2016"
count = 0
for (sl, stl) in zip(s, st):
    if sl != stl:
        count += 1
print count
Buggy python submission (verdict: Runtime Error):
l = map(int, input().split())

a=l[0]
b=l[1]
c=l[2]

A=b-a
B=c-b

if A==B:
    print('Yes')
else:
    print('No')


Fixed submission:
l = list(map(int, input().split()))
 
a=l[0]
b=l[1]
c=l[2]
 
A=b-a
B=c-b
 
if A==B:
    print('YES')
else:
    print('NO')

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

a=l[0] # A
b=l[1] # B
c=l[2] # C

A=b-a
B=c-b

if A==B:
    print('Yes')
else:
    print('No')

Fixed submission:
l = list(map(int, input().split()))
 
a=l[0]
b=l[1]
c=l[2]
 
A=b-a
B=c-b
 
if A==B:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())
a=l[0] # A
b=l[1] # B
c=l[2] # C

A=b-a
B=c-b

if A==B:
    print('Yes')
else:
    print('No')

Fixed submission:
l = list(map(int, input().split()))
 
a=l[0]
b=l[1]
c=l[2]
 
A=b-a
B=c-b
 
if A==B:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())
a-l[0] # A
b=l[1] # B
c=l[2] # C

A=b-a
B=c-b

if A==B:
    print('Yes')
else:
    print('No')

Fixed submission:
l = list(map(int, input().split()))
 
a=l[0]
b=l[1]
c=l[2]
 
A=b-a
B=c-b
 
if A==B:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())

A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')


Fixed submission:
l = input().split()
A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')

Buggy python submission (verdict: Runtime Error):
#l = raw_input().split()
A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')


Fixed submission:
l = input().split()
A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')

Buggy python submission (verdict: Runtime Error):
#l = map(str, raw_input().split())

A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')



Fixed submission:
l = input().split()
A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')

Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())

A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')


Fixed submission:
l = input().split()
A=l[0]
B=l[1]

if A=='H' and B=='H':
    print('H')

elif A=='H'and B=='D':
    print('D')

elif A=='D' and B=='H':
    print('D')
else:
    print('H')
Buggy python submission (verdict: Runtime Error):
l = input().split()

a=l[1]
b=l[2]

X=abs(a-b)
print(X)


Fixed submission:
L = input().split()

w=int(L[0])
a=int(L[1])
b=int(L[2])

if a<b:
    if a+w<b:
        move=abs(a+w-b)
        print(move)
    else:
        print(int(0))

elif a>b:
    if b+w<a:
        m=abs(b+w-a)
        print(m)
    else:
        print(int(0))

else:
    print(int(0))
Buggy python submission (verdict: Time Limit Exceeded):
import math
N=int(input())
X=math.factorial(N)
Y=X%(1000000007)
print(Y)

Fixed submission:
import math
N=int(input())
X=math.factorial(N)
Y=X%(1000000007)
print(Y)
Buggy python submission (verdict: Runtime Error):
N = input()
a=(map(str, raw_input().split()))

odd=a[1::2]
even=a[0::2]

if N%2==0:
    print ' '.join(reversed(odd))+' '+' '.join(even)
else:
    print ' '.join(reversed(even))+' '+' '.join(odd)
~                                                       

Fixed submission:
N = input()
a=(map(str, raw_input().split()))

odd=a[1::2]
even=a[0::2]

if N%2==0:
    print ' '.join(reversed(odd))+' '+' '.join(even)
else:
    print ' '.join(reversed(even))+' '+' '.join(odd)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
a=(map(int, raw_input().split()))

o=[]
e=[]

if len(a)%2==0:
  mid=N/2
  for i in range(mid):
    e.append(str(a[2*i]))
    o.insert(0, str(a[2*i+1]))
else:
  mid=N/2
  for i in range(mid):
    o.insert(0,str(a[2*i]))
    e.append(str(a[2*i+1]))
  o.insert(0, str(a[-1]))

print ' '.join(o)+' '+' '.join(e)


Fixed submission:
N = input()
a=(map(str, raw_input().split()))

odd=a[1::2]
even=a[0::2]

if N%2==0:
    print ' '.join(reversed(odd))+' '+' '.join(even)
else:
    print ' '.join(reversed(even))+' '+' '.join(odd)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = input()
a=(map(int, raw_input().split()))

b=np.array([]).astype(int)

for i in range(N):
    b=np.append(b, [a[i]])
    b=b[-1::-1]

print ''.join(str(b))[1:-1]


Fixed submission:
N = input()
a=(map(str, raw_input().split()))

odd=a[1::2]
even=a[0::2]

if N%2==0:
    print ' '.join(reversed(odd))+' '+' '.join(even)
else:
    print ' '.join(reversed(even))+' '+' '.join(odd)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
a=(map(int, raw_input().split()))

b=[]
for i in range(N):
    b.append(a[i])
    b.reverse()

ans=""
for i in range(len(b)-1):
    ans=ans+str(b[i])+" "
ans=ans+str(b[-1])

print(ans)


Fixed submission:
N = input()
a=(map(str, raw_input().split()))

odd=a[1::2]
even=a[0::2]

if N%2==0:
    print ' '.join(reversed(odd))+' '+' '.join(even)
else:
    print ' '.join(reversed(even))+' '+' '.join(odd)
Buggy python submission (verdict: Runtime Error):
l = raw_input().split(" ")
num=int(l[0])*100+int(l[1])*10+int(l[2])

if num%4==0:
    print("YES")
else:
    print("NO")


Fixed submission:
l = raw_input().split(" ")
num=int(l[0])*100+int(l[1])*10+int(l[2])

if num%4==0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul

n = int(input())
print(reduce(mul, map(range(1,n+1))))

Fixed submission:
n = int(input())
print(sum(range(1,n+1)))
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul

n = int(input())
s = reduce(mul, map(int, input().split(' ')))
print('YES' if s == 175 else 'NO')


Fixed submission:
from functools import reduce
from operator import mul

s = reduce(mul, map(int, input().split(' ')))
print('YES' if s == 175 else 'NO')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())


N = []
for i in range(1,n+1):
	N.append(i)

N2 = 1
for N1 in N:
	N2 = N2 * N1

a = 10**9+7
N2 = N2%a

print N2



Fixed submission:
n = int(raw_input())


N = []
for i in range(1,n+1):
	N.append(i)

N2 = 1
for N1 in N:
	N2 = N2 * N1%(10**9+7)

print N2
Buggy python submission (verdict: Time Limit Exceeded):
N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]


mx = -1e10
cnt = 0

for i in range(len(A)-1):
	if max(A[i+1:]) - A[i] > mx:
		mx = max(A[i+1:]) - A[i]
		cnt = 1

	elif max(A[i+1:]) - A[i] == mx:
		cnt += 1

print cnt

		
		
		


Fixed submission:
N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]

mx = -1e10
cnt = 0
X = []

for i in range(len(A)):
	mx = max(A[-i-1],mx)
	
	dif = mx - A[-i-1]
	
	X.append(dif)



mxx = max(X)

for i in X:
	if i == mxx:
		cnt += 1

print cnt

Buggy python submission (verdict: Time Limit Exceeded):
N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]


mx = -1e10
cnt = 0

for i in range(len(A)-1):
	if max(A[i+1:]) - A[i] > mx:
		mx = max(A[i+1:]) - A[i]
		cnt = 1

	elif max(A[i+1:]) - A[i] == mx:
		cnt += 1

print cnt

Fixed submission:
N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]

mx = -1e10
cnt = 0
X = []

for i in range(len(A)):
	mx = max(A[-i-1],mx)
	
	dif = mx - A[-i-1]
	
	X.append(dif)



mxx = max(X)

for i in X:
	if i == mxx:
		cnt += 1

print cnt

Buggy python submission (verdict: Time Limit Exceeded):
N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]

mx = -1e10
cnt = 0

for i in range(len(A)-1):
	for j in range(i + 1, len(A)):
		if A[j] - A[i] > mx:
			mx = A[j] - A[i]
			cnt = 1

		elif A[j] - A[i] == mx:
			cnt += 1

print cnt



Fixed submission:
N,T = [int(x) for x in raw_input().split(" ")]

A = [int(x) for x in raw_input().split(" ")]

mx = -1e10
cnt = 0
X = []

for i in range(len(A)):
	mx = max(A[-i-1],mx)
	
	dif = mx - A[-i-1]
	
	X.append(dif)



mxx = max(X)

for i in X:
	if i == mxx:
		cnt += 1

print cnt
Buggy python submission (verdict: Runtime Error):
N,M = map(int,raw_input().split())

W = [['inf' for j in range(N)] for i in range(N)]
y = ['inf' for i in range(N)]
y_t = ['inf' for i in range(N)]
y[0] = 0
y_t[0] = 0

for i in range(N):
    W[i][i]=0

for i in range(M):
    a,b,c=map(int,raw_input().split())
    W[a-1][b-1] = c

flag = False

for i in range(N):
    for j in range(N):
        yj_max = 'inf'
        for k in range(N):
            yj_temp = 'inf'
            if y[k]!='inf' and W[k][j]!='inf':
                yj_temp=y[k]+W[k][j]
            if yj_temp!='inf':
                if yj_temp=='inf':
                    yj_max = yj_temp
                elif yj_max<yj_temp:
                    yj_max = yj_temp
        y_t[j]=yj_max
    if y==y_t:
        flag = True
        break
    y = y_t
    

print y[N-1]


Fixed submission:
A,B,C = map(int,raw_input().split())

if C>=A and C<=B:
    print 'Yes'
else:
    print 'No'

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

road_list = [[] for i in range(N)]

W = [[-2*(10**9)-1 for j in range(N)] for i in range(N)]
y = [-2*(10**9)-1 for i in range(N)]
y_t = [-2*(10**9)-1 for i in range(N)]
y[0] = 0
y_t[0] = 0

for i in range(N):
    W[i][i]=0

for i in range(M):
    a,b,c=map(int,raw_input().split())
    W[a-1][b-1] = c

flag = False

for i in range(N):
    for j in range(N):
        yj_max = -2*(10**9)-1
        for k in range(N):
            yj_temp = -2*(10**9)-1
            if y[k]!=-2*(10**9)-1 and W[k][j]!=-2*(10**9)-1:
                yj_temp=y[k]+W[k][j]
            if yj_max<yj_temp:
                yj_max = yj_temp
        y_t[j]=yj_max
    if y==y_t:
        flag = True
        break
    y = y_t
    

if flag:
    print y[N-1]
else:
    print 'infty'

Fixed submission:
A,B,C = map(int,raw_input().split())

if C>=A and C<=B:
    print 'Yes'
else:
    print 'No'
Buggy python submission (verdict: Runtime Error):
N,K = map(int,raw_input().split())

a_list=[]
b_list=[]
count = 0
for i in range(N):
    a,b = map(int,raw_input().split())
    a_list.append(a)
    b_list.append(b)

for i in range(N):
    count+=b[i]
    if count>=K:
        print a[i]
        break


Fixed submission:
N,K = map(int,raw_input().split())

ab_list=[]

count = 0
for i in range(N):
    a,b = map(int,raw_input().split())
    ab_list.append([a,b])
    
ab_list = sorted(ab_list,key=lambda ab:ab[0])

for i in range(N):
    count+=ab_list[i][1]
    if count>=K:
        print ab_list[i][0]
        break
Buggy python submission (verdict: Runtime Error):
N,M = map(int,raw_input().split())

W = [['inf' for j in range(N)] for i in range(N)]
y = ['inf' for i in range(N)]
y_t = ['inf' for i in range(N)]
y[0] = 0
y_t[0] = 0

for i in range(N):
    W[i][i]=0

for i in range(M):
    a,b,c=map(int,raw_input().split())
    W[a-1][b-1] = c

flag = False

for i in range(N):
    for j in range(N):
        yj_max = 'inf'
        for k in range(N):
            yj_temp = 'inf'
            if y[k]!='inf' and W[k][j]!='inf':
                yj_temp=y[k]+W[k][j]

                    if yj_max=='inf':
                        yj_max = yj_temp
                    elif yj_max<yj_temp:
                        yj_max = yj_temp
        y_t[j]=yj_max
    if y==y_t:
        flag = True
        break
    y = y_t
    
if flag:
    print y[N-1]
else:
    print 'inf'

Fixed submission:
N, M = map(int, raw_input().split())
D = [map(int, raw_input().split()) for _ in range(M)]
 
score = [None for _ in range(N+1)]
score[1] = 0
 
for _ in range(N):
    for a, b, c in D:
        if score[a] != None:
            score[b] = max(score[b], score[a] + c)
v1 = score[-1]
for _ in range(N):
    for a, b, c in D:
        if score[a] != None:
            score[b] = max(score[b], score[a] + c)
v2 = score[-1]
 
if v1 != v2:
    print "inf"
else:
    print v2
Buggy python submission (verdict: Runtime Error):
N,M = map(int,raw_input().split())
node_list = [0 for l in range(N)]
for i in range(M):
    items = map(int,raw_input().split())
    node_list[items[0]-1]+=1
    node_list[items[1]-1]+=1
flag=False
for n in range(N):
    if n%2==1:
        flag=True
        
if flag:
    print 'NO'
else:
    print 'YES'

Fixed submission:
A,B,C = map(int,raw_input().split())

if A==B and B==C:
    if A%2==0 and B%2==0 and C%2==0:
        print -1
    else:
        print 0
else:
    for i in range(1000):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC

Buggy python submission (verdict: Runtime Error):
N,M = map(int,raw_input().split())
node_list = [0 for l in range(N)]
for i in range(M):
    items = map(int,raw_input().split())
    node_list[items[0]-1]+=1
    node_list[items[1]-1]+=1
flag=False
for n in range(N):
    if n%2==1:
        flag=True
        
if flag:
    print 'NO'
else:
    print 'YES'


Fixed submission:
A,B,C = map(int,raw_input().split())

if A==B and B==C:
    if A%2==0 and B%2==0 and C%2==0:
        print -1
    else:
        print 0
else:
    for i in range(1000):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC

Buggy python submission (verdict: Runtime Error):

N,M = map(int,raw_input().split())
node_list = [0 for l in range(N)]
for i in range(M):
    items = map(int,raw_input().split())
    node_list[items[0]-1]+=1
    node_list[items[1]-1]+=1
flag=False
for i in range(N):
    if node_list[i]%2==1:
        flag=True
        
if flag:
    print 'YES'
else:
    print 'NO'



Fixed submission:
A,B,C = map(int,raw_input().split())

if A==B and B==C:
    if A%2==0 and B%2==0 and C%2==0:
        print -1
    else:
        print 0
else:
    for i in range(1000):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC
Buggy python submission (verdict: Runtime Error):

N = int(raw_input())
A = map(int,raw_input().split())

count=1
z1=0
for i in range(N-1):
    if A[i+1]-A[i]>0:
        z2=1
    elif A[i+1]-A[i]<0:
        z2=-1
    elif A[i+1]-A[i]==0:
        z=0
    if z2*z1<0:
        count+=1
    if z2!=0:
        z1=z2

print str(count)

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

count=1
z1=0
for i in range(N-1):
    if A[i+1]-A[i]>0:
        z2 = 1
    elif A[i+1]-A[i]<0:
        z2 = -1
    elif A[i+1]-A[i]==0:
        z2 = 0
    if z2*z1<0:
        count+=1
        z1=0
    elif z2!=0:
        z1=z2

print str(count)

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

count=1
z1=0
for i in range(N-1):
    if A[i+1]-A[i]>0:
        z2=1
    elif A[i+1]-A[i]<0:
        z=-1
    elif A[i+1]-A[i]==0:
        z=0
    if z2*z1<0:
        count+=1
    if z2!=0:
        z1=z2

print str(count)

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

count=1
z1=0
for i in range(N-1):
    if A[i+1]-A[i]>0:
        z2 = 1
    elif A[i+1]-A[i]<0:
        z2 = -1
    elif A[i+1]-A[i]==0:
        z2 = 0
    if z2*z1<0:
        count+=1
        z1=0
    elif z2!=0:
        z1=z2

print str(count)