ZhenlongDai/ACPR huggingface dataset:
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
a = list( input().split())
cnt = 0

if (len(a) == 3) and (a[1] == 2):
  cnt = 1

else:
  for i in range ( 1, len(a)-1):
    if (a[i-1]<a[i]<a[i+1]) or (a[i+1]<a[i]<a[i-1]):
      cnt += 1
    
print (cnt)    


Failing test case input:
9
6 12 6 2 5 6 7 4 1

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
n = int( input())
a = list( map( int, input().split()))
cnt = 0

for i in range ( 1, len(a)-1):
  if (a[i-1]<a[i]<a[i+1]) or (a[i+1]<a[i]<a[i-1]):
    cnt += 1
    
print (cnt)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
list_A = list(map(int,input().split()))
 
ans = 0
for i in range(N-3):
  if list_A[i+1] > list_A[i] and list_A[i+1] < list_A[i+2]:
    ans+=1
  if list_A[i+1] < list_A[i] and list_A[i+1] > list_A[i+2]:
    ans+=1
  else:
    pass
 
print(ans)

Failing test case input:
9
25 6 3 2 5 12 10 4 2

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
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)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input().rstrip())
p = [int(x) for x in input().rstrip().split()]

print(p)

count = 0
for i in range(1, n - 1):
    if (p[i] > p[i - 1] and p[i] < p[i + 1]) or \
        (p[i] < p[i - 1] and p[i] > p[i + 1]):
        count += 1
print(count)


Failing test case input:
9
14 12 3 2 5 25 16 4 0

Expected output:
5


Actual output:
[14, 12, 3, 2, 5, 25, 16, 4, 0]
5


Fixed submission (verdict: Accepted):
n = int(input().rstrip())
p_string = input().rstrip().split()
p = [int(x) for x in p_string]

count = 0
for i in range(1, n - 1):
    if (p[i] > p[i - 1] and p[i] < p[i + 1]) or \
        (p[i] < p[i - 1] and p[i] > p[i + 1]):
        count += 1
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n):
    r = p[i:i+3]
    if len(r) == 3:
        if max(r)> p[1] < min(r):
            count += 1

print(str(count))


Failing test case input:
5
1 3 5 4 2

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n):
    r = p[i:i+3]
    if len(r) == 3:
        if max(r) > r[1] and r[1] > min(r):
            count += 1
print(str(count))

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int, input().split()))

result=0
for i in range(1,n-1):
  if max(p[i-1:i+1]) != p[i] and min(p[i-1:i+1]) != p[i]:
    result +=1
print(result)

Failing test case input:
9
0 12 3 4 5 40 7 4 0

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int, input().split()))

result=0
for i in range(1,n-1):
  if max(p[i-1:i+2]) != p[i] and min(p[i-1:i+2]) != p[i]:
    result +=1
print(result)
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

li = list(map(int,input().split()))

co = 0

for i in range(1,len(li)-1):
  a = li[i-1]
  b = li[i]
  c = li[i+1]
  
  if a < b and b < c:
    co += 1
print(co)

Failing test case input:
9
14 6 3 2 5 14 7 4 0

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())

li = list(map(int,input().split()))

co = 0

for i in range(1,len(li)-1):
  work = sorted([li[i-1],li[i],li[i+1]])

  if work.index(li[i]) == 1:
    co += 1
print(co)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
num = input().split(' ')
count = 0
for i in range(int(N) - 2):
  if (int(num[i]) < int(num[i+1]) and int(num[i+1]) < int(num[i+2])) or (int(num[i+2]) < int(num[i+1]) and int(num[i]) < int(num[i+1])):
      count += 1
print(count)

Failing test case input:
9
14 12 3 2 5 14 7 4 -1

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
N = input()
num = input().split(' ')
count = 0
for i in range(int(N) - 2):
  if (int(num[i]) < int(num[i+1]) and int(num[i+1]) < int(num[i+2])) or (int(num[i+2]) < int(num[i+1]) and int(num[i+1]) < int(num[i])):
      count += 1
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = map(int,input().split())
ans = 0
for i in range(3,n-1):
    if i-1 < i < i+1 :
        ans += 1
    elif i-1 > i > i+1 :
        ans += 1
    else:
        continue
print(ans)

Failing test case input:
9
6 12 6 2 5 6 7 4 1

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(n-2):
    if p[i] < p[i+1] < p[i+2] :
        ans += 1
    elif p[i] > p[i+1] > p[i+2] :
        ans += 1
    else:
        continue
else:
    print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())
num_list = list(map(int, input().split()))

count = 1

for i in range(n-2):
    num_id = i+1
    temp = [num_list[num_id-1], num_list[num_id], num_list[num_id+1]]
    list_sorted = sorted(temp)

    if list_sorted[1] == num_list[1]:
        count += 1

print(count)


Failing test case input:
9
14 12 3 2 7 21 7 4 0

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):

n = int(input())
num_list = list(map(int, input().split()))

count = 0

for i in range(n-2):
    num_id = i+1
    temp = [num_list[num_id-1], num_list[num_id], num_list[num_id+1]]
    list_sorted = sorted(temp, reverse=True)
    if list_sorted[1] == num_list[num_id]:
        count += 1


print(count)
Problem: p02988
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(n-1):
    if p[i-1]<=p[i]<p[i+1] or p[i+1]<=p[i]<p[i-1] :
        ans+=1
    else:
        ans==ans
print(ans)

Failing test case input:
9
3 6 3 2 5 14 7 4 2

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):




n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(1,n-1):
    if p[i-1]<=p[i]<p[i+1] or p[i+1]<=p[i]<p[i-1] :
        ans+=1

    else:
        ans==ans
print(ans)

Problem: p02988
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):





n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(n-1):
    if p[i-1]<p[i]<p[i+1] or p[i+1]<p[i]<p[i-1] :
        ans+=1

    else:
        ans==ans
print(ans)

Failing test case input:
9
6 12 6 2 5 6 7 4 0

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):




n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(1,n-1):
    if p[i-1]<=p[i]<p[i+1] or p[i+1]<=p[i]<p[i-1] :
        ans+=1

    else:
        ans==ans
print(ans)

Problem: p02988
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):




n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(n-1):
    if p[i-1]<p[i]<p[i+1] or p[i+1]<p[i]<p[i-1] :
        ans+=1
    else:
        ans==ans
print(ans)

Failing test case input:
9
14 21 2 7 5 25 7 4 0

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):




n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(1,n-1):
    if p[i-1]<=p[i]<p[i+1] or p[i+1]<=p[i]<p[i-1] :
        ans+=1

    else:
        ans==ans
print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int,input().split()))
c = 0

for i in range(1,n - 1):
    if p[i - 1] < p[i] and p[i] < p[i + 1]:
        c = c + 1

print(c)

Failing test case input:
9
14 12 3 2 7 14 7 4 0

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int,input().split()))
c = 0

for i in range(1,n-1):
    if p[i-1] < p[i] and p[i] < p[i+1]:
        c = c + 1

    if p[i-1] > p[i] and p[i] > p[i+1]:
        c = c + 1

print(c)

Problem: p02988
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
P = list(map(int, input().split()))
c = 0
for i in range(n-1):
    if P[i-1] < P[i] < P[i+1]:
        c += 1
    elif P[i+1] < P[i] < P[i-1]:
        c += 1
print(c)

Failing test case input:
9
14 17 0 2 5 25 7 4 0

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
P = list(map(int, input().split()))
c = 0
for i in range(1, n-1):
    if P[i-1] < P[i] < P[i+1]:
        c += 1
    elif P[i+1] < P[i] < P[i-1]:
        c += 1
print(c)
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=list(input().split())
cnt=0
print(p)
for i in range(1,n-1):
    if p[i]!=max(p[i-1],max(p[i],p[i+1])) and p[i]!=min(p[i-1],min(p[i],p[i+1])):
        cnt+=1
    elif p[i+1]==p[i-1] and p[i-1]>p[i]:
        cnt+=1

print(cnt)

Failing test case input:
9
14 12 3 2 5 3 7 4 0

Expected output:
3


Actual output:
['14', '12', '3', '2', '5', '3', '7', '4', '0']
1


Fixed submission (verdict: Accepted):
n=int(input())
p=list(input().split())
p=[int(i) for i in p]
cnt=0
for i in range(1,n-1):
    if p[i]!=max(p[i-1],max(p[i],p[i+1])) and p[i]!=min(p[i-1],min(p[i],p[i+1])):
        cnt+=1
print(cnt)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A = int(input())
x = list(map(int, input().split()))
count=0
for i in range(A-2):
    b=x[i:i+3]
    a=sorted(b)
    print(a)
    if a[1] == b[1]:
        count=count+1
print(count)


Failing test case input:
9
18 6 3 2 5 8 11 4 1

Expected output:
5


Actual output:
[3, 6, 18]
[2, 3, 6]
[2, 3, 5]
[2, 5, 8]
[5, 8, 11]
[4, 8, 11]
[1, 4, 11]
5


Fixed submission (verdict: Accepted):
A = int(input())
x = list(map(int, input().split()))
count=0
for i in range(A-2):
    b=x[i:i+3]
    a=sorted(b)
    if a[1] == b[1]:
        count=count+1
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
Pn = list(input().split(' '))

count_pn = 0
for i in range(1,N-1):
    if ( Pn[i-1] <= Pn[i] and Pn[i] < Pn[i+1] ) or ( Pn[i+1] <= Pn[i] and Pn[i] < Pn[i-1] ):
        count_pn += 1
print(count_pn)

Failing test case input:
9
14 18 0 2 5 14 11 3 -1

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
Pn = list(map(int,input().split(' ')))

count_pn = 0
for i in range(1,N-1):
    if ( Pn[i-1] < Pn[i] < Pn[i+1] ) or ( Pn[i+1] < Pn[i] < Pn[i-1] ):
        count_pn += 1
print(count_pn)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = input().split()

cnt = 0
for i in range(0, n-2):
    print(p[i])
    if (p[i] < p[i+1] < p[i+2]) or (p[i] > p[i+1] > p[i+2]):
        cnt += 1
print("cnt", cnt)

Failing test case input:
9
25 6 3 2 5 14 7 4 2

Expected output:
5


Actual output:
25
6
3
2
5
14
7
cnt 2


Fixed submission (verdict: Accepted):
n = int(input())
p = [int(_) for _ in input().split()]

cnt = 0
for i in range(0, n-2):
    if (p[i] < p[i+1] < p[i+2]) or (p[i] > p[i+1] > p[i+2]):
        cnt += 1
print(cnt)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(1,n-2):
  if p[i-1] < p[i] < p[i+1] or p[i+1] < p[i] < p[i-1]:
    count+=1
print(count)

Failing test case input:
9
14 12 3 2 5 6 9 4 0

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(1,n-1):
  if p[i-1] < p[i] < p[i+1] or p[i+1] < p[i] < p[i-1]:
    count+=1
print(count)
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
p = []
input_first = input()
for ki in range(6):
    p = input_first.rstrip().split(' ')
count = 0
for i in range(0,int(n)-1):
    if (p[i] > p[i-1] and p[i] < p[i+1]) or (p[i] < p[i-1] and p[i] > p[i+1]):
        count += 1
    else:
        pass
print(count)


Failing test case input:
9
14 6 3 1 5 14 7 4 0

Expected output:
5


Actual output:
3


Fixed submission (verdict: Accepted):
n = input()
p = []
input_first = input()
for ki in range(int(n)):
    p = input_first.rstrip().split(' ')
count = 0
for i in range(1,int(n)-1):
    if int(p[i]) > int(p[i-1]) and int(p[i]) < int(p[i+1]):
        count += 1
    elif int(p[i]) < int(p[i-1]) and int(p[i]) > int(p[i+1]):
        count += 1
    else:
        pass
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
p = list(map(int, input().split()))
count = 0


for i in range(0,N-2):
    if p[i] < p[i+1] and p[i+1] < p[i+2]:
        count += 1
print(count)

Failing test case input:
9
14 17 3 2 5 25 7 4 0

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
p = list(map(int, input().split()))
count = 0


for i in range(0,N-2):
    if p[i] < p[i+1] and p[i+1] < p[i+2]:
        count += 1
    elif p[i] > p[i+1] and p[i+1] > p[i+2]: 
        count += 1
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

p_list = [int(p) for p in input().split()]

c = 0
for i, p in enumerate(p_list[1:]):
    p_1 = p_list[i-1]
    p_2 = p_list[i]
    p_3 = p_list[i+1]

    if p_1 < p_2 < p_3 or p_3 < p_2 < p_1:
        c += 1
        

print(c)

Failing test case input:
5
2 1 2 4 3

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())

p_list = [int(p) for p in input().split()]

c = 0
for i in range(1,n-1):
    p_1 = p_list[i-1]
    p_2 = p_list[i]
    p_3 = p_list[i+1]

    
    if (p_1 <= p_2 <= p_3) or (p_3 <= p_2 <= p_1):
        c += 1
        

print(c)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=list(map(int,input().split()))
print(n)
print(p)
i=1
l=[]
while i<n-1:
  if p[i-1]<p[i]<p[i+1] or p[i-1]>p[i]>p[i+1]:
    l.append(i)
  else:
    pass
  i+=1
print(len(l))

Failing test case input:
9
6 12 6 2 5 6 7 4 1

Expected output:
4


Actual output:
9
[6, 12, 6, 2, 5, 6, 7, 4, 1]
4


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int,input().split()))


i=1
l=[]
while i<n-1:
  if p[i-1]<p[i]<p[i+1] or p[i-1]>p[i]>p[i+1]:
    l.append(i)
  else:
    pass
  i+=1
print(len(l))
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-2):
  if p[i] < p[i+1] < p[i+2]:
    count += 1
  else:
    pass

Failing test case input:
9
14 12 3 2 5 6 7 4 0

Expected output:
5


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-2):
  if p[i] < p[i+1] < p[i+2] or p[i] > p[i+1] > p[i+2]:
    count += 1
  else:
    pass
  
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
nums = input().split()

cnt=0

for i in range(1,len(nums)-1):
  if nums[i-1] < nums[i]:
    if nums[i] < nums[i+1]:
      cnt+=1
  if nums[i+1] < nums[i]:
    if nums[i] < nums[i-1]:
      cnt+=1
      
print(cnt)
  

Failing test case input:
9
13 12 6 2 5 0 7 4 0

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
n = input()
nums = input().split(' ')

nums = [int(num) for num in nums]
cnt=0

for i in range(1,len(nums)-1):
  if nums[i-1] < nums[i] and nums[i] < nums[i+1]:
    cnt += 1
  if nums[i+1] < nums[i] and nums[i] < nums[i-1]:
    cnt += 1
      
print(cnt)

Problem: p02988
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
p=list(input().split())

count=0
for i in range(n-2):
    sorted_p=sorted(p[i:i+3])
    if p[i+1]==sorted_p[1]:
        count+=1

print(count)


Failing test case input:
9
14 12 3 2 7 39 7 4 0

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int,input().split()))

count=0
for i in range(n-2):
    sorted_p=sorted(p[i:i+3])
    if p[i+1]==sorted_p[1]:
        count+=1

print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=input().split()
ans=0
for i in range(1,n-1):
    if p[i+1]>p[i]>p[i-1] or p[i-2]>p[i-1]>p[i]:
        ans+=1
print(ans+1)

Failing test case input:
9
14 18 0 2 5 14 7 4 -1

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
    if p[i-1]<p[i]<p[i+1] or p[i+1]<p[i]<p[i-1]:
        ans+=1
print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
long = int(input())
p = input()
plng = []
pstr = p.split(" ")
n = 0

for i in range(long):
    plng.append(int(pstr[i]))


for i in range(long-2):
    three = [plng[i-1],plng[i],plng[i+1]]
    three.sort()

    if three[1] == plng[i]:
     n = n + 1

print(n)


Failing test case input:
9
14 6 3 2 5 14 9 4 0

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
long = int(input())
p = input()
plng = []
pstr = p.split(" ")
n = 0

for i in range(long):
    plng.append(int(pstr[i]))



for i in range(long-2):
    three = [plng[i],plng[i+1],plng[i+2]]
    three.sort()

    if three[1] == plng[i + 1]:
     n = n + 1

print(n)
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

p = input().split()

count = 0
for i in range(len(p) - 2):
    x = p[i:i+3]
    if x[1] == sorted(x)[1]:
        count += 1
print(count)


Failing test case input:
9
14 12 3 2 5 14 7 4 -1

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
p = [int(x) for x in input().split()]

count = 0
for i in range(len(p) - 2):
    x = p[i:i+3]
    if x[1] == sorted(x)[1]:
        count += 1
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int, input().split()))

i=1
count=0
for i in range(n-1):
    if((p[i]>p[i+1] and p[i]<p[i-1]) or (p[i]<p[i+1] and p[i]>p[i-1])):
        count +=1
print(count)        


Failing test case input:
9
3 6 3 2 5 14 7 4 0

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
pi = list(map(int, input().split()))
count =0
for i in range(len(pi)-2):
    if((pi[i+1]>pi[i] and pi[i+1]<pi[i+2]) or(pi[i+1]<pi[i] and pi[i+1]>pi[i+2])):
        count +=1
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
p = input()
n = list(map(int, input().split()))

i = 1
c = 0
for i in range((int(p)-1)):
  s1 = n[i-1]
  s2 = n[i]
  s3 = n[i+1]
  if s1 < s2 and s2 < s3:
    c += 1
  if s1 > s2 and s2 > s3:
    c += 1
print(c)
               

Failing test case input:
9
14 21 2 7 5 25 7 4 0

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
p = int(input())
n = list(map(int, input().split()))

c = 0
for d in range((p-2)):
  if(d+1 < p):
    s1 = n[d]
    s2 = n[d+1]
    s3 = n[d+2]
  
    if s1 < s2 and s2 < s3:
      c += 1
    if s1 > s2 and s2 > s3:
      c += 1
  else:
    break
    
print(c)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())

p=input().split()

A=0

for i in range(1,n-2):
    if p[i-1]<p[i]<p[i+1] or p[i-1]>p[i]>p[i+1]:
        A=A+1

print(A)


Failing test case input:
9
14 12 3 2 6 14 1 4 0

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())

p=list(map(int, input().split()))

A=0

for i in range(1,n-1):
    if p[i-1]<p[i]<p[i+1] :
        A=A+1
    elif p[i-1]>p[i]>p[i+1]:
        A=A+1

print(A)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=list(input().split())
cnt=0
for i in range(1,n-1):
    if p[i]!=max(p[i-1],max(p[i],p[i+1])) and p[i]!=min(p[i-1],min(p[i],p[i+1])):
        cnt+=1
print(cnt)

Failing test case input:
9
14 12 3 2 4 17 7 4 -1

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
p=list(input().split())
p=[int(i) for i in p]
cnt=0
for i in range(1,n-1):
    if p[i]!=max(p[i-1],max(p[i],p[i+1])) and p[i]!=min(p[i-1],min(p[i],p[i+1])):
        cnt+=1
print(cnt)
Problem: p02988
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
p = list(map(int, input().split()))
 
ans = 0
for i in range(1, n-1):
  if p[i] > p[i-1] and p[i] < p[i+1]: ans += 1
 
print(ans)

Failing test case input:
9
14 6 3 2 5 14 7 4 1

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int, input().split()))
 
ans = 0
for i in range(1, n-1):
  M = max(p[i-1], p[i], p[i+1])
  m = min(p[i-1], p[i], p[i+1])
  if p[i] != M and p[i] != m: ans += 1

print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int,input().split()))
c = 0
for i in range(1,n-1):
  if p[i-1] < p[i] < p[i+1] or (p[i-1] == p[i] and p[i] < p[i+1]):
    c += 1
print(c)

Failing test case input:
9
14 12 0 2 5 14 7 4 -1

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int,input().split()))
c = 0
for i in range(1,n-1):
  if p[i-1] <= p[i] < p[i+1] or p[i-1]>p[i]>=p[i+1]:
    c += 1
print(c)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
Pn = list(input().split(' '))

count_pn = 0
for i in range(1,N-1):
    if ( Pn[i-1] < Pn[i] < Pn[i+1] ) or ( Pn[i+1] < Pn[i] < Pn[i-1] ):
        count_pn += 1
print(count_pn)


Failing test case input:
9
14 12 -1 2 5 26 7 4 -1

Expected output:
5


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
Pn = list(map(int,input().split(' ')))

count_pn = 0
for i in range(1,N-1):
    if ( Pn[i-1] < Pn[i] < Pn[i+1] ) or ( Pn[i+1] < Pn[i] < Pn[i-1] ):
        count_pn += 1
print(count_pn)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(1,n-1):
	if p[i]>p[i-1] and p[i]<p[i+1]:
		count+=1
print('{}'.format(count))

Failing test case input:
9
14 6 3 1 5 14 0 4 0

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(1,n-1):
	if (p[i]>p[i-1] and p[i]<p[i+1]) or (p[i]<p[i-1] and p[i]>p[i+1]):
		count+=1
print('{}'.format(count))

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = list(map(int,input().split()))
c = 0

for i in range(a-2):
  if b[i]<b[i+1]<b[i+2]:
    c+=1
else:
  print(c)

Failing test case input:
9
14 6 3 2 5 14 7 4 1

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
a = int(input())
b = list(map(int,input().split()))
c = 0

for i in range(a-2):
  if b[i]<b[i+1]<b[i+2] or b[i+2]<b[i+1]<b[i]:
    c+=1
else:
  print(c)
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
numbers = input().split()

result = 0

if n >= "3":
	number_list = []

	for i in numbers:
		number_list.append(i)
		if len(number_list) < 3:
			continue
		elif len(number_list) > 3:
			number_list.pop(0)

		sorted_list = sorted(number_list)
		
		if sorted_list[1] == number_list[1]:
			result += 1

print(result)


Failing test case input:
9
14 12 5 2 5 25 16 4 0

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = input()
numbers = [int(n) for n in input().split()]

result = 0

number_list = []

for i in numbers:
	number_list.append(i)
	if len(number_list) < 3:
		continue
	elif len(number_list) > 3:
		number_list.pop(0)

	sorted_list = sorted(number_list)
	
	if sorted_list[1] == number_list[1]:
		result += 1

print(result)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
P_list = list(map(int,(input().split(" "))))

count = 0
i = 1
for i in range(n-1):
    a = (P_list[i-1] < P_list[i] and P_list[i + 1] > P_list[i]) or (P_list[i-1] > P_list[i] and P_list[i+1] < P_list[i])
    if a:
        count = count + 1



print(count)


Failing test case input:
9
14 17 3 4 2 25 7 4 0

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
P_list = list(map(int,(input().split(" "))))

count = 0
i = 0
for i in range(n-2):
    if P_list[i] > P_list[i+1] > P_list[i+2] or P_list[i] < P_list[i+1] < P_list[i+2]:
        count = count + 1


print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
def calc(n, p):
    count = 0
    for i, pn in enumerate(p):
        if i == 0 or i == len(p)-1:
            continue
        sortedPn = sorted([p[i-1], p[i], p[i+1]])

        if len(collections.Counter(sortedPn)) != 1 and pn == sortedPn[1]:
            count += 1
    return count
print(calc(input(), list(input().split())))

Failing test case input:
9
14 12 5 2 5 25 6 7 0

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
def calc(n, p):
    count = 0
    for i in range(1, n-1):
        if p[i-1] < p[i] and p[i] < p[i+1]:
            count += 1
            continue
        if p[i-1] > p[i] and p[i] > p[i+1]:
            count += 1
            continue
    return count
print(calc(int(input()), [int(a) for a in input().split()]))

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=list(map(int,input().split()))
print(p)
sum=0
for i in range(1,n-1):
    if p[i]>=p[i-1] and p[i]<=p[i+1]:
        sum+=1
    elif p[i]>=p[i+1] and p[i]<=p[i-1]:
        sum+=1

print(sum)

Failing test case input:
9
14 12 3 2 5 25 16 4 0

Expected output:
5


Actual output:
[14, 12, 3, 2, 5, 25, 16, 4, 0]
5


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int,input().split()))
sum=0
for i in range(1,n-1):
    if p[i]>=p[i-1] and p[i]<=p[i+1]:
        sum+=1
    elif p[i]>=p[i+1] and p[i]<=p[i-1]:
        sum+=1

print(sum)
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
p = []
input_first = input()
for ki in range(int(n)):
    p = input_first.rstrip().split(' ')
count = 0
for i in range(1,int(n)-1):
    if (p[i] > p[i-1] and p[i] < p[i+1]) or (p[i] < p[i-1] and p[i] > p[i+1]):
        count += 1
    else:
        pass
print(count)


Failing test case input:
9
14 12 3 2 7 21 7 4 0

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = input()
p = []
input_first = input()
for ki in range(int(n)):
    p = input_first.rstrip().split(' ')
count = 0
for i in range(1,int(n)-1):
    if int(p[i]) > int(p[i-1]) and int(p[i]) < int(p[i+1]):
        count += 1
    elif int(p[i]) < int(p[i-1]) and int(p[i]) > int(p[i+1]):
        count += 1
    else:
        pass
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=input()
S=list(input().split())
count=0
for i in range(1,len(S)-1):
    if (S[i-1]<=S[i] and S[i+1]>S[i]) or (S[i-1]>S[i] and S[i+1]<=S[i]):
        count+=1
print(count)

Failing test case input:
9
14 21 3 7 5 25 7 4 0

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int,input().split()))
cnt =0
for i in range(1,n-1):
    if p[i-1]<=p[i]<=p[i+1] or p[i+1]<=p[i]<=p[i-1]:
        cnt +=1
print(cnt)

Problem: p02988
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


n = int(input())
P = list(map(int,input().split()))
K = 0
for i in range(n-2):
    T = [P[i], P[i+1], P[i+2]]
    T.sort()
    if T[2] == P[i+1]:
        K += 1
        
print(K)

Failing test case input:
9
14 12 3 2 5 3 7 4 0

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):


n = int(input())
P = list(map(int,input().split()))
K = 0
for i in range(n-2):
    if (P[i] < P[i+1] and P[i+1] < P[i+2]) or (P[i+2] < P[i+1] and P[i+1] < P[i]):
        K += 1
        
print(K)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = input().split()

cnt = 0
for i in range(1, n - 1):
    if (p[i - 1] < p[i] < p[i+1] or p[i-1] < p[i] < p[i + 1]):
        cnt += 1
    else:
        continue

print(cnt)


Failing test case input:
9
13 12 3 2 5 6 7 2 0

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(1, n-1):
    if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
        ans += 1
    else:
        continue

print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = [int(i) for i in input().split()]
ctn = 0
for j in range(1, n-2):
    if p[j -1] < p[j] < p[j + 1]:
        ctn += 1
print(ctn)

Failing test case input:
9
13 12 6 2 5 0 7 4 0

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
p = [int(i) for i in input().split()]
ctn = 0
for j in range(1, n-1):
    if p[j - 1] < p[j] < p[j + 1] or p[j + 1] < p[j] < p[j - 1]:
        ctn += 1
print(ctn)
Problem: p02988
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
p = [int(i) for i in input().split()]

ans = 0
for i in range(n-1):
    a = [p[i-1], p[i], p[i+1]]
    a.sort()
    if a[1] != p[i] and a[1] != a[2]:
        ans += 1

print(ans)

Failing test case input:
9
14 17 3 4 2 25 7 4 0

Expected output:
2


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
p = [int(i) for i in input().split()]

ans = 0
ps = []
for i in range(n-2):
    a = p[i:i+3]
    if a[0] <= a[1] < a[2] or a[2] <= a[1] < a[0]:
        ans += 1

print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input().strip()
n = int(n)
i = list(map(int, input().split()))
ans = 0
for a in range(n):
    if a == 0:
        pass
    if a == n-1:
        pass
    else:
        if i[a-1] > i[a] and i[a] > i[a+1] or i[a-1]<i[a] and i[a]< i[a+1]:
            ans += 1
        else:
            pass
print(ans)
            

Failing test case input:
9
14 18 0 2 5 14 11 3 -1

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n = input().strip()
n = int(n)
i = list(map(int, input().split()))
ans = 0
for a in range(n):
    if a == 0:
        pass
    elif a == n-1:
        pass
    else:
        if i[a-1] > i[a] and i[a] > i[a+1] or i[a-1]<i[a] and i[a]< i[a+1]:
            ans += 1
        if i[a-1] == i[a] and i[a] > i[a+1] or i[a+1] == i[a] and i[a] > i[a-1]:
            ans += 1
        else:
            pass
print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
print (a)
count=0
for i in range(1,n-1):
    if a[i-1]<a[i]and a[i]<a[i+1] or a[i-1]>a[i]and a[i]>a[i+1]:
        count+=1
print(count)

Failing test case input:
9
14 12 3 2 5 14 7 4 0

Expected output:
5


Actual output:
[14, 12, 3, 2, 5, 14, 7, 4, 0]
5


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(1,n-1):
    if a[i-1]<a[i]and a[i]<a[i+1] or a[i-1]>a[i]and a[i]>a[i+1]:
        count+=1
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
def calc(n, p):
    count = 0
    for i, pn in enumerate(p):
        if i == 0 or i == len(p)-1:
            continue
        pCount = 0
        if pn < p[i-1]:
            pCount += 1
        if pn < p[i+1]:
            pCount += 1
        if pCount == 1 or (pn < p[i-1] and p[i-1] == p[i+1]):
            count += 1
    return count
print(calc(input(), list(input().split())))

Failing test case input:
9
14 18 0 2 5 14 11 3 -1

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
def calc(n, p):
    count = 0
    for i in range(1, n-1):
        if p[i-1] < p[i] and p[i] < p[i+1]:
            count += 1
            continue
        if p[i-1] > p[i] and p[i] > p[i+1]:
            count += 1
            continue
    return count
print(calc(int(input()), [int(a) for a in input().split()]))
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())

p=input().split()

A=0

for i in range(n-2):
    if p[i]<p[i+1]<p[i+2] or p[i]>p[i+1]>p[i+2]:
        A=A+1

print(A)


Failing test case input:
9
14 12 3 2 9 14 7 4 0

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())

p=list(map(int, input().split()))

A=0

for i in range(1,n-1):
    if p[i-1]<p[i]<p[i+1] :
        A=A+1
    elif p[i-1]>p[i]>p[i+1]:
        A=A+1

print(A)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(1, n-1):
  if p[i-1]<p[i] and p[i]<p[i+1]:
    ans += 1
print(ans)


Failing test case input:
9
9 6 3 2 5 14 7 4 1

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(1, n-1):
  if p[i-1]<p[i] and p[i]<p[i+1]:
    ans += 1
  if p[i-1]>p[i] and p[i]>p[i+1]:
    ans += 1
print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
p = []
input_first = input()
for ki in range(6):
    p = input_first.rstrip().split(' ')
count = 0
for i in range(1,int(n)-1):
    if (p[i] > p[i-1] and p[i] < p[i+1]) or (p[i] < p[i-1] and p[i] > p[i+1]):
        count += 1
    else:
        pass
print(count)



Failing test case input:
9
14 3 5 2 5 25 16 4 0

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n = input()
p = []
input_first = input()
for ki in range(int(n)):
    p = input_first.rstrip().split(' ')
count = 0
for i in range(1,int(n)-1):
    if int(p[i]) > int(p[i-1]) and int(p[i]) < int(p[i+1]):
        count += 1
    elif int(p[i]) < int(p[i-1]) and int(p[i]) > int(p[i+1]):
        count += 1
    else:
        pass
print(count)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=list(map(int,input().split()))
cnt=0
for i in range(n-2):
  if l[i]<l[i+1]<l[i+2]:
    cnt+=1
print(cnt)

Failing test case input:
9
13 12 3 2 5 6 7 3 0

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(int,input().split()))
cnt=0
for i in range(n-2):
  if l[i]<l[i+1]<l[i+2] or l[i]>l[i+1]>l[i+2]:
    cnt+=1
print(cnt)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n):
    r = p[i:i+3]
    if len(r) == 3:
        if max(r)> p[1] and p[1] > min(r):
            count += 1

print(str(count))


Failing test case input:
9
14 12 3 2 7 39 7 4 0

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n):
    r = p[i:i+3]
    if len(r) == 3:
        if max(r) > r[1] and r[1] > min(r):
            count += 1
print(str(count))
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
def calc(n, p):
    count = 0
    for i, pn in enumerate(p):
        if i == 0 or i == len(p)-1:
            continue
        sortedPn = sorted(collections.Counter([p[i-1], p[i], p[i+1]]))

        if len(sortedPn) != 1 and pn == sortedPn[1]:
            count += 1
    return count
print(calc(input(), list(input().split())))

Failing test case input:
9
14 12 3 2 5 17 7 4 -1

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
def calc(n, p):
    count = 0
    for i in range(1, n-1):
        if p[i-1] < p[i] and p[i] < p[i+1]:
            count += 1
            continue
        if p[i-1] > p[i] and p[i] > p[i+1]:
            count += 1
            continue
    return count
print(calc(int(input()), [int(a) for a in input().split()]))

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
nums = input().split()

cnt=0

for i in range(1,len(nums)-1):
  if nums[i-1] < nums[i]:
    if nums[i] <= nums[i+1]:
      cnt+=1
  if nums[i+1] < nums[i]:
    if nums[i] <= nums[i-1]:
      cnt+=1
      
print(cnt)
  

Failing test case input:
9
26 12 3 2 3 14 1 4 -1

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
n = input()
nums = input().split(' ')

nums = [int(num) for num in nums]
cnt=0

for i in range(1,len(nums)-1):
  if nums[i-1] < nums[i] and nums[i] < nums[i+1]:
    cnt += 1
  if nums[i+1] < nums[i] and nums[i] < nums[i-1]:
    cnt += 1
      
print(cnt)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n = int(input())
p = [int(i) for i in input().split()]

cnt = 0
for i in range(1,n-1):
    q = [p[i-1],p[i],p[i+1]]
    q.sort()
    if p[i] == q[1]:
        print('y')
        cnt += 1

print(cnt)

Failing test case input:
9
14 12 3 4 5 25 7 4 0

Expected output:
5


Actual output:
y
y
y
y
y
5


Fixed submission (verdict: Accepted):


n = int(input())
p = [int(i) for i in input().split()]

cnt = 0
for i in range(1,n-1):
    q = [p[i-1],p[i],p[i+1]]
    q.sort()
    if p[i] == q[1]:
        cnt += 1

print(cnt)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = list(map(int, input().split()))

l = 0
for i in range(0, n-1):
    if s[i-1] < s[i] < s[i+1] or s[i+1] < s[i] < s[i-1]:
        l += 1

print(l)


Failing test case input:
9
14 21 3 4 5 25 7 4 0

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
s = list(map(int, input().split()))

l = 0
for i in range(1, n-1):
    if s[i-1] < s[i] < s[i+1] or s[i+1] < s[i] < s[i-1]:
        l += 1

print(l)
Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=list(input().split())
cnt=0
for i in range(1,n-1):
    if p[i]!=max(p[i-1],max(p[i],p[i+1])) and p[i]!=min(p[i-1],min(p[i],p[i+1])):
        cnt+=1
    elif p[i+1]==p[i-1] and p[i-1]<p[i]:
        cnt+=1
print(cnt)

Failing test case input:
9
14 12 3 2 5 17 7 4 -1

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
p=list(input().split())
p=[int(i) for i in p]
cnt=0
for i in range(1,n-1):
    if p[i]!=max(p[i-1],max(p[i],p[i+1])) and p[i]!=min(p[i-1],min(p[i],p[i+1])):
        cnt+=1
print(cnt)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
arr = list(map(int, input().strip().split()))


for i in range(1, n-1):
    if (arr[i] > arr[i-1] and arr[i] < arr[i+1]) or (arr[i] < arr[i-1] and arr[i] > arr[i+1]):
        print(i+1)
        break

Failing test case input:
9
13 12 3 2 5 6 7 4 0

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
arr = list(map(int, input().strip().split()))

r = 0
for i in range(1, n-1):
    if (arr[i] > arr[i-1] and arr[i] < arr[i+1]) or (arr[i] < arr[i-1] and arr[i] > arr[i+1]):
        r += 1

print(r)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
seq_str = input().split(" ")
seq = [int(s) for s in seq_str]
counter = 0

for i in range(1,n-1):
    if (seq[i-1]-seq[i])*(seq[i+1]-seq[i]) < 0:
        counter =+ 1
print(counter)

Failing test case input:
9
14 12 3 2 5 14 7 4 0

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
seq_str = input().split(" ")
seq = [int(s) for s in seq_str]
counter = 0

for i in range(1,n-1):
    if (seq[i-1]-seq[i])*(seq[i+1]-seq[i]) < 0:
        counter += 1
print(counter)

Problem: p02988
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
ps = list(map(int, input().split()))
ans = 0

for i in range(1, len(ps)-1):
    if ps[i] == min(ps[i-1], ps[i], ps[i+1]):
        ans += 1
print(ans)


Failing test case input:
9
14 12 5 2 5 25 16 7 0

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
ps = list(map(int, input().split()))
ans = 0

for i in range(1, len(ps)-1):
    s1 = ps[i-1] < ps[i] and ps[i+1] > ps[i]
    s2 = ps[i-1] > ps[i] and ps[i+1] < ps[i]
    if s1 or s2:
        ans += 1

print(ans)

Problem: p02988
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(input().split())
cnt = 0
for n in range(1,N-1):
    if (P[n-1] < P[n]) and (P[n] < P[n+1]):
        cnt += 1
    elif (P[n-1] > P[n]) and (P[n] > P[n+1]):
        cnt += 1
print(cnt)


Failing test case input:
9
25 6 3 2 5 25 7 4 2

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
P = [int(i)for i in input().split()]
cnt = 0
for n in range(1,N-1):
    if (P[n-1] < P[n] < P[n+1] or P[n-1] > P[n] > P[n+1]):
        cnt+=1
print(cnt)
Problem: p03724
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
chk = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  chk[a-1] += 1
  chk[b-1] += 1
ans = 'Yes'
for i in chk:
  if i % 2  == 1:
    ans = 'No'
print(ans)

Failing test case input:
10 1
1 1
6 6
5 2
3 4
3 3

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
chk = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  chk[a-1] += 1
  chk[b-1] += 1
ans = 'YES'
for i in chk:
  if i % 2  == 1:
    ans = 'NO'
print(ans)

Problem: p03724
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

U = [0] * (N + 2)
for A, B in AB:
  U[A + 1] += 1
  U[B + 1] -= 1


for u in U:
  if u % 2:
    print("No")
    exit()
print("Yes")

Failing test case input:
6 5
1 2
3 5
5 1
3 4
2 4

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

U = [0] * (N + 2)
for A, B in AB:
  U[A + 1] += 1
  U[B + 1] -= 1


for u in U:
  if u % 2:
    print("NO")
    exit()
print("YES")

Problem: p03724
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
r = [0]*(N+1)
for _ in range(M):
    a, b = map(int, input().split())
    r[a-1] += 1
    r[b-1] -= 1

x = 0
for i in range(N-1):
    x += r[i]
    if x<=0 or x%2==1:
        print("NO")
        break
else:
    print("YES")

Failing test case input:
10 1
1 1
6 9
5 2
3 4
3 3

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
r = [0]*(N+1)
for _ in range(M):
    a, b = map(int, input().split())
    r[a-1] += 1
    r[b-1] += 1

for i in range(N-1):
    if r[i]%2==1:
        print("NO")
        break
else:
    print("YES")

Problem: p03724
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,m=map(int,input().split())
g=[0]*(n+1)
for _ in range(m):
  a,b=map(int,input().split())
  g[a]+=1
  g[b]+=1
  g[a]%=2
  g[b]%=2
  
print("YES" if max(g) else "NO")


Failing test case input:
14 2
1 2
2 -1
0 1
-2 4
0 1

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
g=[0]*(n+1)
for _ in range(m):
  a,b=map(int,input().split())
  g[a]+=1
  g[b]+=1
  g[a]%=2
  g[b]%=2
  
print("YES" if 1-max(g) else "NO")
Problem: p03724
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())  

counter = [0] * N

for _ in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    counter[a] += 1
    counter[b] += 1

flag = True
for i in range(len(counter)):
    if counter[i] % 2 != 0:
        flag = False


if flag:
    print('Yes')
else:
    print('No')


Failing test case input:
10 0
1 1
2 6
7 2
-1 4
1 3

Expected output:
YES


Actual output:
Yes


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

counter = [0] * N

for _ in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    counter[a] += 1
    counter[b] += 1

flag = True
for i in range(len(counter)):
    if counter[i] % 2 != 0:
        flag = False


if flag:
    print('YES')
else:
    print('NO')

Problem: p03724
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    import sys
    input = sys.stdin.readline
    N, M = map(int, input().split())
    C = [0]*(N+1)
    for i in range(M):
        a, b = map(int, input().split())
        C[a]+=1
        C[b]+=1
    for i in range(N+1):
        if C[i] % 2 == 1:
            return "NO"
    return "YES"

main()


Failing test case input:
10 0
2 1
2 4
11 2
-1 5
0 5

Expected output:
YES


Actual output:

Fixed submission (verdict: Accepted):
def main():
    import sys
    input = sys.stdin.readline
    N, M = map(int, input().split())
    C = [0]*(N+1)
    for i in range(M):
        a, b = map(int, input().split())
        C[a]+=1
        C[b]+=1
    for i in range(N+1):
        if C[i] % 2 == 1:
            return "NO"
    return "YES"

print(main())

Problem: p03724
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N,M=map(int,input().split())
NL=[0 for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    NL[a-1]+=1
    NL[b-1]+=1

flg=True

for i in range(N):
    if NL[i]%2==1:
        flg=False

if flg:
    print("Yes")
else:
    print("No")


Failing test case input:
14 2
0 1
2 5
1 1
-2 4
0 1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):

N,M=map(int,input().split())
NL=[0 for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    NL[a-1]+=1
    NL[b-1]+=1

flg=True

for i in range(N):
    if NL[i]%2==1:
        flg=False

if flg:
    print("YES")
else:
    print("NO")

Problem: p03724
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
c = [0] * (N+1)

for _ in range(M):
    a, b = map(int, input().split())
    c[a] += 1
    c[b] += 1

print("Yes" if all(c[i]%2 == 0 for i in range(N+1)) else "No")

Failing test case input:
5 5
1 2
3 5
5 1
3 4
2 3

Expected output:
NO

Actual output:
No


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
c = [0] * (N+1)

for _ in range(M):
    a, b = map(int, input().split())
    c[a] += 1
    c[b] += 1

print("YES" if all(c[i]%2 == 0 for i in range(N+1)) else "NO")