ZhenlongDai/ACPR huggingface dataset:
Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
P=list(map(int,input().split()))
Pmax=0
result=0
for i in range(N):
  if P[i]<=Pmax:
    result+=1
  else:
    Pmax=P[i]
print(result)

Failing test case input:
6
1 2 2 2 5 9

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N=int(input())
P=list(map(int,input().split()))
Pmin=P[0]
result=0
for i in range(N):
  if P[i]<=Pmin:
    result+=1
    Pmin=P[i]
    
print(result)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(map(int, input().split()))
a=0
i=1
while i != N:
    if P[i] <= P[i-1]:
        a+=1
    i+=1

print(a)


Failing test case input:
6
1 16 17 -1 2 19

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
P = list(map(int, input().split()))
a=1
i=0
b = P[0]
for i in range(1,N):
    if P[i] <= b:
        a+=1
        b = P[i]
print(a)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=list(map(int, input().split()))
ans=0
min=2*100000
for i in range(n):
    num_now=l[i]
    if num_now<min:
        ans+=1
print(ans)


Failing test case input:
6
1 6 9 0 2 11

Expected output:
2


Actual output:
6


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(int, input().split()))
ans=0
min=2*100000
for i in range(n):
    num_now=l[i]
    if num_now<=min:
        ans+=1
        min=num_now
print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]>v:
        k+=1
print(k)

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

Expected output:
1


Actual output:
6


Fixed submission (verdict: Accepted):
a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]<v:
        k+=1
        v=b[i]
print(k)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(map(int,input().split()))

count = 1
    
for i in range(N-1):
    if(P[i+1] < P[i]):
        count += 1
        
print(count)

Failing test case input:
6
0 3 2 3 5 27

Expected output:
1


Actual output:
2


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

count = 1
max = P[0]
for i in range(1,N):
    if(max >= P[i]):
        max = P[i]
        count += 1
print(count)
Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(map(int,input().split()))
count = 1

for i in range(1, N):
  isbreak = False
  for j in range(0,i):
    print(P[i])
    print(P[j])
    if (P[i] > P[j]):
      isbreak = True
      break
  if isbreak == False:
    count += 1
    
print(count)
  

Failing test case input:
6
0 3 4 3 5 18

Expected output:
1


Actual output:
3
0
4
0
3
0
5
0
18
0
1


Fixed submission (verdict: Accepted):
N = int(input())
P = list(map(int,input().split()))
count = 1
 
if N > 0:
  min = P[0]
  
for i in range(1, N):
  isbreak = False
  
  if min < P[i]:
    continue
  elif min >= P[i]:
    min = P[i]
    count += 1
    continue  
  for j in range(0,i):
    if (P[i] > P[j]):
      isbreak = True
      break
  if isbreak == False:
    count += 1
    
print(count)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p_lst = list(map(int,input().split()))
number = 0
p_i = p_lst[0]

for i in range(n):
    if p_lst[i]<=p_i:
        number += 1
    p_i = p_lst[i]
print(number)

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

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
p_lst = list(map(int,input().split()))
number = 1
p_min = p_lst[0]

for i in range(1,n):
    if p_lst[i]<=p_min:
        number += 1
        p_min = p_lst[i]

print(number)

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

p_min = Pn[0]
cnt = 0
for i in Pn:
    if i <=p_min:
        cnt += 1
    p_min = min(p_min, i)


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

Expected output:
1


Actual output:

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

p_min = Pn[0]
count = 0
for i in Pn:
    if i <=p_min:
        count += 1
    p_min = min(p_min, i)
print(count)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
A=list(map(int,input().split()))
qq=A[0]
ans=1
for i in range(n-1):
  if qq<A[i+1]:
    qq=A[i+1]
    continue
  else:
    ans+=1
print(ans)
    

Failing test case input:
6
0 6 2 2 5 27

Expected output:
1


Actual output:
4


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

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=input()
arr=input().split()

min=int(arr[0])
cnt=0
for i in range(len(arr)):
    if min >= int(arr[i]):
        cnt+=1
        print(i)
    else:
        min = int(arr[i])

print(cnt)

Failing test case input:
6
0 4 2 3 5 27

Expected output:
1


Actual output:
0
2
3
3


Fixed submission (verdict: Accepted):
N=input()
arr=input().split()

min=int(arr[0])
cnt=0
for i in range(len(arr)):
    if min >= int(arr[i]):
        cnt+=1
        min = int(arr[i])
print(cnt)
Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(map(int, input().split()))

ans = 0
min = P[0]
for i in P:
  if min > i:
    min = i
  elif i > min:
    ans += 1
print(ans)
    
  

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

Expected output:
1


Actual output:
5


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

ans = 0
min = P[0]
for i in P:
  if min >= i:
    min = i
    ans += 1
print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=[]
mx=0
cnt=0
for i in a:
  mx=max(mx,i)
  if mx<=i:
    cnt+=1
print(cnt)

Failing test case input:
6
1 0 3 6 18 9

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
b=[]
mx=10**10
cnt=0
for i in a:
  mx=min(mx,i)
  if mx>=i:
    cnt+=1
print(cnt)

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

cnt = int(n)

for i in range(int(n)):
    if i == 0:
        min = p[i]
    if p[i] > min:
        cnt = cnt - 1
    else:
        if(min > p[i]):
            min = p[i]
print(cnt)

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

Expected output:
4


Actual output:
3


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

for i in range(n):  
    if p[i] > min:
        cnt = cnt - 1
    else:
        min = p[i]
print(cnt)

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



N=int(input())
P=input().split()

c=1
m=int(P[0])
for i in range(1,N):
    if int(P[i-1])>int(P[i]):
        c+=1
        m=int(P[i])


print(c)

Failing test case input:
6
1 0 3 6 29 16

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):



N=int(input())
P=input().split()

c=1
m=int(P[0])
for i in range(1,N):
    if m>int(P[i]):
        c+=1
        m=int(P[i])


print(c)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
min = N + 1
AC = 0
for i in range(N):
  if min < A[i]:
    min = A[i]
    AC += 1
print(AC)

Failing test case input:
5
4 2 6 1 4

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
min = N + 1
AC = 0
for i in range(N):
  if min > A[i]:
    min = A[i]
    AC += 1
print(AC)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=list(map(int,input().split()))
ans=0
tmp=0
for i in range(1,n):
    if tmp>=l[i]:
      tmp=l[i]
      ans+=1
print(ans)


Failing test case input:
6
0 3 1 2 5 27

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(int,input().split()))
ans=0
tmp=l[0]
for i in range(n):
    if tmp>=l[i]:
      tmp=l[i]
      ans+=1
print(ans)
Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if x == 1:
        break
    if min_v>=x:
        min_v=x
    else:
        ans+=1
print(ans)

Failing test case input:
6
-1 3 3 5 5 9

Expected output:
1


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if min_v>x:
        min_v=x
        ans+=1
print(ans)

Problem: p02791
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):
  if i == 0:
    count+=1
  elif p[i - 1] >= p[i]:
    count+=1
print(count)

Failing test case input:
6
-1 3 3 3 5 9

Expected output:
1


Actual output:
3


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

result = 0
m = P[0]
for i in range(N):
    if P[i] <= m:
        result += 1
        m = P[i]
print(result)

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

ans = 0
for i in range(n):
    for j in range(i+1):
        if (p[i] <= p[j]):
            ans += 1
            break
print(ans)


Failing test case input:
6
1 6 9 0 5 7

Expected output:
2


Actual output:
6


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

ans = 0
pmax = p[0]
for i in range(n):
    if (p[i] <= pmax):
        ans += 1
        pmax = p[i]

print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int , input().split()))
count = 0
for i in (reversed(range(1,N))):
    if A[i] < A[i-1]:
        count+=1
print(count+1)

Failing test case input:
6
0 3 2 3 5 13

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int , input().split()))
count = 0
j = A[0]
for i in range(len(A)):
    j = min(j , A[i])
    if j >= A[i]:
        count += 1
print(count)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = [int(x) for x in input().split()]
ans = 1

for i in range(1, N):
    a = P[:i-1]
    b = P[i]
    if i == 1:
        a = [P[0]]
    if min(a) > b:
        ans += 1
print(ans)

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

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
N = int(input())
P = [int(x) for x in input().split()]
ans = 1

m = P[0]
for i in range(1, N):
    m = min(m, P[i])
    if m == P[i]:
        ans += 1

print(ans)

Problem: p02791
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
ans = 1
tmp = a[0]
for i in range(n):
  if a[i] < tmp:
    tmp = i
    ans += 1
print(ans)

Failing test case input:
6
0 33 17 -1 2 19

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
ans = 1
tmp = a[0]
for i in a:
  if i < tmp:
    tmp = i
    ans += 1
print(ans)
Problem: p02791
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
P=list(map(int,input().split()))
ans=1
for i in range(1,N):
    if max(P[:i])==max(P):
        break
    if min(P[:i])>P[i]:
        ans+=1
print(ans)

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

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
N=int(input())
P=list(map(int,input().split()))
x=N+1
cnt=0

for i in range(N):
    if P[i]<x:
        cnt+=1
        x=P[i]
print(cnt)

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


min_i = [x[0]]

for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n-1):
    if min_i[i-1] < x[i]:
        count=count+1


    


print(n-count)


Failing test case input:
6
0 3 2 3 5 13

Expected output:
1


Actual output:
2


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



min_i = [x[0]]

for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1


    


print(n-count)

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


Failing test case input:
6
0 10 17 -1 2 19

Expected output:
2


Actual output:
3


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

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(map(int,input().split()))
ans = 1
for i in range(1,N):
  j = i - 1
  if P[i] <= P[j]:
    ans += 1
  else:
    pass
print(ans)

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

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
P = list(map(int,input().split()))
ans = 1
Pj = P[0]
for i in range(1,N):
  Pj = min(Pj,P[i])
  if P[i] <= Pj:
    ans += 1
  else:
    pass
print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
Plist = list(map(int, input().split()))
now = Plist[0]
ans = 0
for p in Plist:
    if p <= now:
        ans += 1

    now = p
print(ans)


Failing test case input:
6
1 2 0 6 5 9

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
Plist = list(map(int, input().split()))
ans = 0
M = Plist[0]
for i in range(N):
    M = min(M, Plist[i])
    if Plist[i] == M:
        ans += 1
print(ans)
Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
p = input().split()

cnt = int(n)

for i in range(int(n)):
    if i == 0:
        min = p[i]
    if p[i] > min:
        cnt = cnt - 1
    else:
        min = p[i]

print(cnt)

Failing test case input:
6
2 6 17 0 2 19

Expected output:
2


Actual output:
3


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

for i in range(n):  
    if p[i] > min:
        cnt = cnt - 1
    else:
        min = p[i]
print(cnt)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
P=list(map(int,input().split()))
ans=1
MIN=10**6
for i in range(1,N):
  MIN=min(MIN,P[i])
  if MIN>=P[i]:
    ans+=1
print(ans)    

Failing test case input:
6
2 6 17 0 2 19

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N=int(input())
P=list(map(int,input().split()))
ans=0
MIN=10**6
for i in range(N):
  MIN=min(MIN,P[i])
  if MIN>=P[i]:
    ans+=1
print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = [int(i) for i in input().split()]
c = 0
for i, pi in enumerate(p):
    if pi > p[i-1]:
        continue
    if pi == min(p[:i+1]):
        c += 1
print(c+1)

Failing test case input:
6
-1 2 3 3 5 9

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
p = [int(i) for i in input().split()]
c = 0
minp = p[0]
for pi in p:
    if pi < minp:
        minp = pi
        c += 1
print(c+1)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=list(map(int,input().split()))
i=1
for k in range(n-1):
  if s[k]>=s[k+1]:
    i+=1
print(i)

Failing test case input:
6
0 3 4 3 5 18

Expected output:
1


Actual output:
2


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

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

Failing test case input:
5
3 2 5 0 3

Expected output:
3


Actual output:
4


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

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
a = [int(x) for x in input().split()]
count=1
mini=a[0]
print(a)
for i in range (1,N):
    if a[i]<mini:
        count=count+1
        mini=a[i]

print(count)

Failing test case input:
6
1 2 0 6 5 9

Expected output:
2


Actual output:
[1, 2, 0, 6, 5, 9]
2


Fixed submission (verdict: Accepted):
N=int(input())
a = [int(x) for x in input().split()]
count=1
mini=a[0]

for i in range (1,N):
    if a[i]<mini:
        count=count+1
        mini=a[i]

print(count)
Problem: p02791
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
a = reversed(a)

ans = 0
b4 = -1000000000
for i in a:
    if(b4 < i):ans+=1
    b4=i
print(ans)

Failing test case input:
6
0 3 2 3 3 27

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
minn = 10000000000
ans = 0
for i in a:
    if(minn > i):
        minn = i
        ans+=1

print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
p=list(map(int,input().split()))
k=1
for i in range(a-1):
    if p[i+1]<p[i]:
        k+=1
print(k)


Failing test case input:
6
1 0 3 6 18 9

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]<v:
        k+=1
        v=b[i]
print(k)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
List = [int(x) for x in input().split()]

cnt = 0
min_num = List[0]

for i in List[1:]:
    if i < min_num:
        min_num = i
        cnt += 1
print(cnt)


Failing test case input:
6
1 0 3 6 9 9

Expected output:
2


Actual output:
1


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

cnt = 1
min_num = List[0]

for i in List[1:]:
    if i < min_num:
        min_num = i
        cnt += 1
print(cnt)

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

j = p[0]
count = 0
for i in range(n):
    if p[i] <= j:
        count += 1
    j = p[i]
print(count)

Failing test case input:
6
1 0 3 6 9 9

Expected output:
2


Actual output:
3


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

j = p[0]
count = 0
for i in range(n):
    if j >= p[i]:
        count += 1
        j = p[i]
print(count)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
P = input().split(' ')
count = 0
for i, Pi in enumerate(P):
    if i == 0:
        count = count +1
    elif Pi == min(P):
        count = count +1
        break
    elif Pi<= min(P[0:i]):
        count = count +1
print(count)

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

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
N = input()
P = input().split(' ')
count = 0
for i, Pi in enumerate(P):
    if i == 0:
        count = count +1
        Pmin = int(Pi)

    elif Pmin>=int(P[i]):
        count = count +1
        Pmin = int(Pi)


print(count)
Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
p = [int(e) for e in input().split(" ")]
low = p[0]
c = 0
for i in range(N):
    print(p[i], low)
    if(p[i] <= low):
        c += 1
        low = p[i]
        print(">increment")
print(c)

Failing test case input:
6
0 10 17 -1 2 19

Expected output:
2


Actual output:
0 0
>increment
10 0
17 0
-1 0
>increment
2 -1
19 -1
2


Fixed submission (verdict: Accepted):
N = int(input())
p = [int(e) for e in input().split(" ")]
low = p[0]
c = 0
for i in range(N):
    if(p[i] <= low):
        c += 1
        low = p[i]
print(c)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=input()
arr=input().split()

min=int(arr[0])
cnt=0
for i in range(len(arr)):
    if min >= int(arr[i]):
        cnt+=1
    else:
        min = int(arr[i])

print(cnt)

Failing test case input:
6
1 0 3 6 29 16

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N=input()
arr=input().split()

min=int(arr[0])
cnt=0
for i in range(len(arr)):
    if min >= int(arr[i]):
        cnt+=1
        min = int(arr[i])
print(cnt)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int , input().split()))
count = 0
for i in (reversed(range(1,N))):
    if A[i] <= A[i-1]:
        count+=1
print(count+1)


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

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int , input().split()))
count = 0
j = A[0]
for i in range(len(A)):
    j = min(j , A[i])
    if j >= A[i]:
        count += 1
print(count)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
List=list(map(int,input().split()))
num=1

for i in range(N-1):
  if List[i]>=List[i+1]:
    num = num + 1
  else:
    break

print(num)

Failing test case input:
5
3 2 5 0 1

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
List = list(map(int, input().split()))
num = 0
min = List[0]
for i in range(N):
  if List[i] <= min:
    num += 1
    min = List[i]
print(num)

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


min_i = [x[0]]

for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(0,n-1):
    if min_i[i-1] < x[i]:
        count=count+1


    


print(n-count)


Failing test case input:
6
0 3 3 3 5 18

Expected output:
1


Actual output:
2


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



min_i = [x[0]]

for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1


    


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

Failing test case input:
6
0 3 1 2 5 27

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = float('Inf')
for n in range(N):
    if P[n] < res:
        res = P[n]
        cnt += 1
print(cnt)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
data = list(map(int, input().split()))
ans=0
min=data[0]
if N==1:
    ans=1
elif N>1:
    for i in range(1,N):
        minmin=data[0]
        if data[i]<=minmin:
            minmin=data[i]
            if minmin<=data[i]:
                ans+=1
                continue
        if minmin<=data[i]:
            ans+=1

print(ans)

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

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):
N=int(input())
data = list(map(int, input().split()))
ans=1
minmin=data[0]
if N==1:
    ans=1
elif N>1:
    minmin=data[0]
    for i in range(1,N):

        if data[i]<=minmin:
            minmin=data[i]
            
            ans+=1
                
        
            

print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

INF = 99999999

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

mins = [INF] * N

ans = 1
mins[0] = P[0]

for i in range(1,N):

    if (mins[i-1] > P[i]):
        ans += 1
        mins[i] = P[i]


    else:
        mins[i] = mins[i-1]

Failing test case input:
6
-1 3 3 1 5 9

Expected output:
1


Actual output:

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

INF = 99999999

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

mins = [INF] * N

ans = 1
mins[0] = P[0]

for i in range(1,N):

    if (mins[i-1] > P[i]):
        ans += 1
        mins[i] = P[i]


    else:
        mins[i] = mins[i-1]

print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(map(int, input().split()))

ans = 0
m = 0
for i in range(0, N):
    if m > P[i]:
        m = P[i]
    if P[i] <= m:
        ans += 1

print(ans)

Failing test case input:
6
1 6 9 0 2 11

Expected output:
2


Actual output:
1


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

ans = 0
m = P[0]
for i in range(0, N):
    if m > P[i]:
        m = P[i]
    if P[i] <= m:
        ans += 1

print(ans)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
L = list(map(int, input().split()))

tmp = -1
count = 0
for i in range(N):
    if tmp <= L[i]:
        count += 1
    tmp = max(tmp, L[i])
        
print(count)

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

Expected output:
1


Actual output:
4


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

tmp = 10 ** 10
count = 0
for i in range(N):
    if tmp >= L[i]:
        count += 1
    tmp = min(tmp, L[i])
        
print(count)
Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
lis = input().split(" ")
cnt = 0
for i in range(int(N)):
  dum = lis[:i+1]
  if min(dum) == lis[i]:
    cnt += 1
print(cnt)


Failing test case input:
6
2 6 17 0 2 19

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
lst = list(map(int,input().split()))
 
cnt = 0
m = lst[0]
 
for i in lst:
  if i <= m:
    cnt +=1
    m = i
print(cnt)

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
PN=input().split()
PN=list(map(int,PN))

res=1
for i in range(N-1):
  if PN[i]>=PN[i+1]:
    res+=1
print(res)

Failing test case input:
6
1 2 0 6 5 15

Expected output:
2


Actual output:
3


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

res=0
minim=PN[0]
for i in PN:
  minim=min(minim,i)
  if minim>=i:
    res+=1
print(res)

Problem: p02791
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
p = list(map(int,input().split()))
a = p[0]
ans = 0
for i in range(n):
  if(a<=p[i]):
    ans += 1
    a = p[i]
print(ans)


Failing test case input:
5
3 2 5 0 3

Expected output:
3


Actual output:
2


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

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
k = list(map(int, input().split()))

count = 0
min =9999999

for i in range(1,len(k)):
  if min > k[i]:
    min= k[i]
    count += 1

print(count)

               


Failing test case input:
5
4 2 5 0 3

Expected output:
3


Actual output:
2


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

count = 0
min =99999999

for i in range(len(k)):
  if min > k[i]:
    min= k[i]
    count += 1

print(count)

Problem: p02791
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(n-1):
	if p[i+1] > p[i]:
		cnt += 1
print(n-cnt)

Failing test case input:
6
0 3 1 2 4 27

Expected output:
1


Actual output:
2


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

Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
array = input().split()
count = 1
for k in range(1,len(array)):
    if min(array[:k]) >= array[k]:
        count = count + 1
print(count)

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

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
array = [int(n) for n in input().split()]
count,m = 1,array[0]
for k in range(1,n):
  if array[k] < m:
    m = array[k]
    count = count + 1
print(count)
Problem: p02791
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(input('').split())
print(p)

count = 0
count2 = 0
for i in range(1,n):
    count = 0
    for j in range(i):
        if int(p[j]) >= int(p[i]):
            count += 1
    if count == i:
        count2 += 1

print(count2 + 1)

Failing test case input:
6
2 6 9 0 3 11

Expected output:
2


Actual output:
['2', '6', '9', '0', '3', '11']
2


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

min = 10000000000
count = 0
for i in range(n):
    if min >= int(p[i]):
        count += 1
    if min >= int(p[i]):
        min = int(p[i])

print(count)
Problem: p03975
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, a, b = [ int(v) for v in input().split() ]
ans_list = []
for i in range(n):
  v = int(input())
  if a <= v < b:
    ans_list.append(v)
print(len(ans_list))


Failing test case input:
5 5 5
3
6
11
15
18

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
n, a, b = [ int(v) for v in input().split() ]
ans_list = []
for i in range(n):
    v = int(input())
    if not a <= v < b:
        ans_list.append(v)
print(len(ans_list))

Problem: p03975
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c = map(int, input().split())
ans = 0
for i in range(a):
    n = int(input())
    if n < b:
        ans += 1
print(ans)

Failing test case input:
4 1 6
9
6
8
1

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
a, b, c = map(int, input().split())
ans = 0
for i in range(a):
    n = int(input())
    if n < b or n >= c:
        ans += 1
print(ans)

Problem: p03975
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = list(map(int, input().split()))
t = [int(input()) for x in range(N)]

ans = 0

for i in range(N):
  if t[i] < A or t[i] > B:
    continue
  else:
    ans += 1
    
    
print(ans)
   



Failing test case input:
5 5 5
3
2
9
29
18

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
N, A, B = list(map(int, input().split()))
t = [int(input()) for x in range(N)]

ans = 0

for i in range(N):
  if t[i] < A or t[i] >= B:
    continue
  else:
    ans += 1
    
    
print(N - ans)

Problem: p03975
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, a, b = [ int(v) for v in input().split() ]
ans_list = []
for i in range(n):
    v = int(input())
    if a <= v < b:
        ans_list.append(v)
print(len(ans_list))


Failing test case input:
5 5 5
3
6
11
15
18

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
n, a, b = [ int(v) for v in input().split() ]
ans_list = []
for i in range(n):
    v = int(input())
    if not a <= v < b:
        ans_list.append(v)
print(len(ans_list))

Problem: p03975
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == "__main__":
    N,A,B = map(int, input().split())
    T = list(map(int, input().split()))
    res = 0
    for x in T:
        if (A <= x and x < B):
            continue
        res += 1
    print (res)


Failing test case input:
5 5 5
3
6
11
15
18

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
if __name__ == "__main__":
    N,A,B = map(int, input().split())
    T = []
    for x in range(N):
        x = int(input())
        T.append(x)
    res = 0
    for x in T:
        if (A <= x and x < B):
            continue
        res += 1
    print (res)
Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
num = list(map(int,input().split()))
numabs = [abs(i) for i in num]
cnt = 0    
negative = []        
for i in num :
    if i < 0 :
        cnt += 1
        negative.append(i)

if cnt % 2 == 0 :
    print(sum(numabs))

if cnt % 2 == 1 :
    print(sum(numabs)-2*max(negative))

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

Expected output:
12


Actual output:
16


Fixed submission (verdict: Accepted):
n = int(input())
num = list(map(int,input().split()))
numabs = [abs(i) for i in num]
cnt = 0           
for i in num :
    if i < 0 :
        cnt += 1

if cnt % 2 == 0 :
    print(sum(numabs))

if cnt % 2 == 1 :
    print(sum(numabs) - 2*min(numabs))

Problem: p03062
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
if len(A)%2==0:
 ans=0
 for i in A:
  ans+=abs(i)
 print(ans)
else:
 ans=0
 mins=10**10
 for i in A:
  ans+=abs(i)
  mins=min(mins,abs(i))
 print(ans-2*mins)

Failing test case input:
3
-2 1 -1

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
ans=0
mins=10**10
ct=0
for i in A:
 ans+=abs(i)
 mins=min(mins,abs(i))
 if i<0:
  ct+=1
if ct%2==1:
 ans-=2*mins
print(ans)

Problem: p03062
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split(" ")))

negCount = 0


sum = 0


min = A[0]

for i in A:
    
    if i < 0:
        negCount += 1
        i *= -1

    sum += i

    if i < min:
        min = i


if negCount % 2 == 0:
    print(sum)
    
else:
    print(sum - (min*2))

Failing test case input:
11
-503952896 1000110000 -393529007 1001000000 -2255404057 0 1010010001 -474477572 1000100011 -415342299 1110100100

Expected output:
9164025943


Actual output:
10171931735


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

negCount = 0


sum = 0


min = 0
if A[0] < 0:
    min = A[0] * -1
else:
    min = A[0]

for i in A:
    
    if i < 0:
        negCount += 1
        i *= -1

    sum += i

    if i < min:
        min = i

if negCount % 2 == 0:
    print(sum)
    
else:
    print(sum - (min*2))

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

cnt = 0
for i in a:
    if i < 0:
        cnt += 1

total = sum(a)

if cnt % 2 ==  0:
    print(total)
    exit()
else:
    print(total - 2 * min(a))
    exit()


Failing test case input:
5
10 -4 -8 -11 5

Expected output:
30


Actual output:
38


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

cnt = 0
for i in a:
    if i < 0:
        cnt += 1

a = list(map(abs, a))
total = sum(a)

if cnt % 2 ==  0:
    print(total)
else:
    print(total - 2 * min(a))
Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
c=0
k=0
for i in range(0,n):
  if a[i]<0:
    c=c+1
  k=k+abs(a[i])
  a[i]=abs(a[i])
a.sort()
if c%2==1:
  k=k-a[0]
  print(k)
else:
  print(k)

Failing test case input:
5
10 -4 -8 -11 5

Expected output:
30


Actual output:
34


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
c=0
k=0
for i in range(0,n):
  if a[i]<0:
    c=c+1
  k=k+abs(a[i])
  a[i]=abs(a[i])
a.sort()
if c%2==1:
  k=k-2*a[0]
  print(k)
else:
  print(k)

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

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

ans = 0
cost = float('inf')
count = 0

for i in a:
    ans += abs(i)
    cost = min(cost,abs(i))
    if i < 0:
        count += 1

if 0 not in a:
    
    if count % 2 != 0:
        ans -= cost

print(ans)

Failing test case input:
5
2 -2 -4 -1 7

Expected output:
14


Actual output:
15


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

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

ans = 0
cost = float('inf')
count = 0

for i in a:
    ans += abs(i)
    cost = min(cost,abs(i))
    if i < 0:
        count += 1

if 0 not in a:
    
    if count % 2 != 0:
        ans -= 2*cost

print(ans)

Problem: p03062
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))

if 0 in A:
    S=0
    for a in A:
        S+=abs(a)
    print(S)
else:
    X=0
    S=0
    for a in A:
        X+=(a<0)
        S+=abs(a)

    if X%2==0:
        print(S)
    else:
        b=min(A,key=lambda x:abs(x))
        print(S-2*b)

Failing test case input:
5
2 -1 -4 -1 7

Expected output:
13


Actual output:
17


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

if 0 in A:
    S=0
    for a in A:
        S+=abs(a)
    print(S)
else:
    X=0
    S=0
    for a in A:
        X+=(a<0)
        S+=abs(a)

    if X%2==0:
        print(S)
    else:
        b=abs(min(A,key=lambda x:abs(x)))
        print(S-2*b)

Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
  if a[i]<0:
    cnt+=1
if min(a)>=0 or cnt%2==0:
  print(sum(a))
  exit()
b=[abs(a[i]) for i in range(n)]
s=sum(b)
ans=-10**18
for i in range(n):
  ans=max(ans,s-2*b[i])
print(ans)


Failing test case input:
3
-6 0 -2

Expected output:
8


Actual output:
-8


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
  if a[i]<0:
    cnt+=1
if min(a)>=0:
  print(sum(a))
  exit()
b=[abs(a[i]) for i in range(n)]
s=sum(b)
if cnt%2==0:
  print(s)
  exit()
ans=-10**18
for i in range(n):
  ans=max(ans,s-2*b[i])
print(ans)
Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[int(i) for i in input().split()]
ans=None
a_pos=[abs(i) for i in a]
a_min=min(a_pos)
a_neg=sum([1 if i>=0 else 0 for i in a])
if a_neg%2==0:
    ans=sum(a_pos)
else: ans=sum(a_pos)-2*a_min
print(ans)

Failing test case input:
5
17 -4 -4 -14 5

Expected output:
36


Actual output:
44


Fixed submission (verdict: Accepted):
n=int(input())
a=[int(i) for i in input().split()]
ans=None
a_pos=[abs(i) for i in a]
a_min=min(a_pos)
a_neg=sum([1 if i<0 else 0 for i in a])
if a_neg%2==0:
    ans=sum(a_pos)
else: ans=sum(a_pos)-2*a_min
print(ans)

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

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

ans = 0
count = 0
for i in range(n - 1):
    if a[i] < 0:
        a[i] = -a[i]
        count += 1

ans = sum(a)
if count % 2 == 0:
    print(ans)
else:
    print(ans - min(a) * 2)


Failing test case input:
3
0 0 -10

Expected output:
10


Actual output:
-10


Fixed submission (verdict: Accepted):

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

ans = 0
count = 0
for i in range(n):
    if a[i] < 0:
        a[i] = -a[i]
        count += 1

ans = sum(a)
if count % 2 == 0:
    print(ans)
else:
    print(ans - min(a) * 2)

Problem: p03062
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    ans = sum(map(abs, a))
    m = min(a, key= lambda x: abs(x))
    if 0 in a:
        print(ans)
        return
    cnt = sum([1 for x in a if x < 0])
    if cnt%2 == 0:
        print(ans)    
    else:
        print(ans-2*m)
        
    
    
if __name__ == '__main__':
    main()

Failing test case input:
5
2 -2 -4 -1 7

Expected output:
14


Actual output:
18


Fixed submission (verdict: Accepted):
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    s, m = 0, 10**18
    flag = 1
    for x in a:
        s += abs(x)
        flag ^= (x<0)
        m = min(m, abs(x))

    if flag or (0 in a):
        print(s)
    else:
        print(s-2*m)
        
    
    
if __name__ == '__main__':
    main()

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

ans,cnt,mini=[],0,float('inf')
for a in A:
  if abs(a)!=a: cnt+=1
  ans.append(abs(a))
  mini=min(mini,abs(a))
if cnt%2==0:
  print(sum(ans))
else:
  print(sum(ans)-mini)

Failing test case input:
5
2 -1 -4 -1 7

Expected output:
13


Actual output:
14


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

ans,cnt,mini=[],0,float('inf')
for a in A:
  if abs(a)!=a: cnt+=1
  ans.append(abs(a))
  mini=min(mini,abs(a))
if cnt%2==0:
  print(sum(ans))
else:
  print(sum(ans)-(mini*2))
Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

for i in range(N - 1):
  if A[i] < 0 :
    print(A[i])
    A[i] *= -1
    A[i + 1] *= -1
  elif i == N - 2 and A[i] == 0:
    A[i + 1] *= -1
print(sum(A))

Failing test case input:
11
-503952896 1000010000 -425259316 1000001000 -2255404057 0 1010010001 -474477572 1000100011 -162702447 1100000100

Expected output:
8931917400


Actual output:
-503952896
-1000010000
-2255404057
-474477572
-1000100011
8931917400


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

for i in range(N):
  if A[i] < 0:
    count += 1
    A[i] *= -1
print(sum(A) if count % 2 == 0 else sum(A) - min(A) * 2)

Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))

B = [abs(i) for i in A]
minus = [int(i<0) for i in A]
if sum(minus)%2 == 0:
    print(sum(B))
else:
    print(sum(B))
    print(sum(B)-2*min(B))

Failing test case input:
3
-14 5 1

Expected output:
18


Actual output:
20
18


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

B = [abs(i) for i in A]
minus = [int(i<0) for i in A]
if sum(minus)%2 == 0:
    print(sum(B))
else:
    print(sum(B)-2*min(B))

Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] = abs(a[i])
a.sort()
a[0] *= -1
print(sum(a))
    

Failing test case input:
3
-10 5 -4

Expected output:
19

Actual output:
11


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
k = 1
for i in range(n):
    if a[i] < 0:
        a[i] *= -1
        k *= -1
a.sort()
if k == -1:
    a[0] *= -1
print(sum(a))

Problem: p03062
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
B=[]
C=[]
for i in range(N):
    if A[i]<=0:
        B.append(-A[i])
    else:
        C.append(A[i])
if len(B)%2==0:
       print(sum(B)+sum(C))
else:
       print(sum(B)+sum(C)-2*min(B))
           

Failing test case input:
5
10 -4 -8 -11 3

Expected output:
30

Actual output:
28


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
B=[]
C=[]
for i in range(N):
    if A[i]<=0:
        B.append(-A[i])
    else:
        C.append(A[i])
if len(B)%2==0:
       print(sum(B)+sum(C))
else:
        if C==[]:
            print(sum(B)+sum(C)-2*min(B))
        else:
            print(sum(B)+sum(C)-2*min(min(B),min(C)))
Problem: p03062
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
dat = list(map(int, input().split()))
dat2 = []
cnt = 0
for i in range(n):
    if dat[i] < 0:
        cnt += 1
        dat[i] = abs(dat[i])
    dat2.append(abs(dat[i]))
dat.sort()



if cnt % 2 == 0:
    print(sum(dat2))
else:
    print(sum(dat2) - abs(dat[0]))


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

Expected output:
11


Actual output:
12


Fixed submission (verdict: Accepted):
n = int(input())
dat = list(map(int, input().split()))
maxval = -9999999999999999999
maxind = -1
numminus = 0
dat2 = []

for i in range(n):
    if dat[i] < 0:
        numminus += 1
    dat2.append(abs(dat[i]))

dat2.sort()



if numminus %2 == 0:
    print(sum(dat2))
else:
    dat2[0] *= -1
    print(sum(dat2))

Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
A=list(map(int,input().split()))
B=[0]*n
for i in range(n):
    B[i]=abs(A[i])
B.sort()
print(sum(B)-2*B[0])

Failing test case input:
3
-2 1 -1

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
A=list(map(int,input().split()))
B=[0]*n
cnt=0
for i in range(n):
    if A[i]<0:
        cnt+=1
    B[i]=abs(A[i])
B.sort()
if cnt%2==0:
    print(sum(B))
else:
    print(sum(B)-2*B[0])

Problem: p03062
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
LA=list(map(int,input().split()))

Minus=0
Zero=0
L_absolute=[]

for i in LA:
    if i<0:
        L_absolute.append(i*(-1))
        Minus+=1
    elif i==0:
        Zero=1
    else:
        L_absolute.append(i)
        
L_absolute.sort()

if Zero==0:
    ans=sum(L_absolute)
elif Minus%2==1:
    ans=sum(L_absolute)-2*L_absolute[0]
else:
    ans=sum(L_absolute)
    
print(ans)

Failing test case input:
3
-2 5 1

Expected output:
6


Actual output:
8


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

Minus=0
Zero=0
L_absolute=[]

for i in LA:
    if i<0:
        L_absolute.append(i*(-1))
        Minus+=1
    elif i==0:
        Zero=1
    else:
        L_absolute.append(i)
        
L_absolute.sort()

if Zero==1:
    ans=sum(L_absolute)
elif Minus%2==1:
    ans=sum(L_absolute)-2*L_absolute[0]
else:
    ans=sum(L_absolute)
    
print(ans)

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

ans = 0

count = 0

is_zero = False

for i in range(0, n):
	if(a[i] == 0):
		is_zero = True
	if(a[i] < 0):
		a[i] = a[i] * -1
		count += 1
	ans += a[i]

if(count % 2 != 0 and is_zero == False):
	ans -= 2 * abs(a[n-1])
print(ans)

Failing test case input:
5
10 -4 -4 -11 5

Expected output:
26


Actual output:
24


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

ans = 0

count = 0

is_zero = False

mint = abs(a[0])

for i in range(0, n):
	if(a[i] == 0):
		is_zero = True
	if(a[i] < 0):
		a[i] = a[i] * -1
		count += 1
	ans += a[i]
	mint = min(mint, a[i])

if(count % 2 != 0 and is_zero == False):
	ans -= 2 * mint
print(ans)