ZhenlongDai/ACPR huggingface dataset:
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
A = list(map(int,input().split()))
B = []
total = 0
for i in range(N,0,-1):
    if A[i-1]!=total%2:
        total+=1
        B.append(i)

B.sort()
if len(B)>0:
    print(len(B))
    print(*B)
else:
    print(0)


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
3
2 3 4


Fixed submission (verdict: Accepted):

N = int(input())
A = [0]+list(map(int,input().split()))
B = []
T = [0]*(N+1)

for i in range(N,0,-1):
    total = 0
    v = i
    while v <= N:
        total += T[v]
        v += i
    if total%2 != A[i]:
        T[i]=1
        B.append(i)

B.sort()
if len(B)>0:
    print(len(B))
    print(*B)
else:
    print(0)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.insert(0, 1e10)
    ans = []
    for i in range(1, len(A)):
        idx = i
        s = 0
        while idx <= len(A) - 1:
            s += A[idx]
            idx += i

        if s % 2 != 0:
            ans.append(i)
    
    if len(ans) > 0:
        print(len(ans))
        print(*ans)
    else:
        print(0)


if __name__ == '__main__':
    main()


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.insert(0, 1e10)
    ans = []
    B = [0] * len(A)
    for i in range(len(A)-1, 0, -1):
        idx = i
        s = 0
        while idx <= len(A) - 1:
            s += B[idx]
            idx += i

        if s % 2 != A[i]:
            ans.append(i)
            B[i] = 1

    
    if len(ans) > 0:
        print(len(ans))
        print(*ans)
    else:
        print(0)


if __name__ == '__main__':
    main()

Problem: p02972
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a=[-1]+[int(x) for x in input().split()]
b=[-1]+[0]*n
for i in range(n,0,-1):
  
  if sum(b[::i][1:])%2!=sum(a[::i][1:]):
    b[i]=int(not b[i])
    
    if sum(b[::i][1:])%2!=sum(a[::i][1:]):
      print(-1)
      exit()

ans=[x for x in b if x==1]
print(len(ans))
print(*ans)

Failing test case input:
5
1 1 0 0 0

Expected output:
1
2


Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
a=[-1]+[int(x) for x in input().split()]
b=[-1]+[0]*n
for i in range(n,0,-1):
  
  if sum(b[::i][1:])%2!=a[i]:
    b[i]=int(not b[i])
    
    if sum(b[::i][1:])%2!=a[i]:
      print(-1)
      exit()

ans=[n for n,x in enumerate(b) if x==1]
print(len(ans))
print(*ans)
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
num_line = [0] + list(map(int, input().split()))
for i in range(N, 1, -1):
    if sum(num_line[i::i]) % 2 != num_line[i]:
        num_line[i] = 1
print(num_line.count(1))
print(" ".join(map(str, list(i for i in range(1, N) if num_line[i] == 1))))
print()

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
1



Fixed submission (verdict: Accepted):
N = int(input())
num_line = [0] + list(map(int, input().split()))
for i in range(N
    num_line[i] = sum(num_line[i::i]) % 2
    
        
print(num_line.count(1))
print(" ".join(map(str, list(i for i in range(1, N+1) if num_line[i] == 1))))

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
B = [0 for i in range(N)]
for n in range(N):
    step = N - n
    sm = A[step-1]
    for i in range(step-1, N ,step)[::-1]:
        sm += B[i]
    B[step-1] = (sm%2)
    print (B)

C = " ".join([str(i+1) for i in range(len(B)) if B[i]])
print (C)


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
[0, 0, 0, 0, 0]
[0, 0, 0, 1, 0]
[0, 0, 0, 1, 0]
[0, 0, 0, 1, 0]
[0, 0, 0, 1, 0]
4


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
B = [0 for i in range(N)]
for n in range(N):
    step = N - n
    sm = A[step-1]
    for i in range(step-1, N ,step)[::-1]:
        sm += B[i]
    B[step-1] = (sm%2)
    
print (sum(B))
C = " ".join([str(i+1) for i in range(len(B)) if B[i]])
print (C)

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

for i in range(N-1,-1,-1):
  a = A[i]
  for j in range(i+1,N,i+1):
    if j in ans:
      a += 1
  if a % 2:
    ans.add(i+1)
print(len(ans))
print(*ans)

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
1 5


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

for i in range(N-1,-1,-1):
  a = A[i]
  for j in range(i+1,N+1,i+1):
    if j in ans:
      a += 1
  if a % 2:
    ans.add(i+1)
print(len(ans))
print(*ans)

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

F = set()
for n in range(N, 0, -1):
    a = sum([A[i] for i in range(2 * n, N + 1, n)]) % 2
    if a != A[n]:
        F.add(n)

print(len(F))
L = list(map(str, F))
print(" ".join(L))


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


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

def index(n):
    return [i for i in range(2 * n, N + 1, n)]


F = set()
for n in range(N, 0, -1):
    a = sum([1 if i in F else 0 for i in index(n)])
    if a % 2 != A[n]:
        F.add(n)

print(len(F))
L = list(map(str, F))
print(" ".join(L))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
lis = list(map(int,input().split()))

ans = [0 for i in range(n)]
for num in range(n,0,-1):
  cnt = 0
  for nu in range(num-1,n,num):
    cnt += ans[nu]
  if lis[num-1] != cnt % 2:
    ans[num-1] = 1
  print(ans)
cnt1 = 0
for num in range(n):
  if ans[num] == 1:
    cnt1 += 1
print(cnt1)
for i in range(n):
  if ans[i] == 1:
    print(i+1,end = " ")

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
[0, 0, 0, 0, 1]
[0, 0, 0, 0, 1]
[0, 0, 0, 0, 1]
[0, 0, 0, 0, 1]
[0, 0, 0, 0, 1]
1
5 

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

ans = [0 for i in range(n)]
for num in range(n,0,-1):
  cnt = 0
  for nu in range(num-1,n,num):
    cnt += ans[nu]
  if lis[num-1] != cnt % 2:
    ans[num-1] = 1
cnt1 = 0
for num in range(n):
  if ans[num] == 1:
    cnt1 += 1
print(cnt1)
for i in range(n):
  if ans[i] == 1:
    print(i+1,end = " ")

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
a = list(map(int,input().split()))
if N == 1:
    print(str(a[0]))
    if a[0] == 1:
        print('1')
else:
    ans = []
    for i in range(N-1,-1,-1):
        sumi = sum(a[2*i+1::i+1])
        if a[i] != sumi%2:
            ans.append(str(i+1))
    ans.sort()
    print(str(len(ans)))
    if len(ans) != 0:
        print(' '.join(ans))


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


Fixed submission (verdict: Accepted):
N=int(input())
a = list(map(int,input().split()))
if N == 1:
    print(a[0])
    if a[0] == 1:
        print(1)
else:
    ball = [0 for i in range(N)]
    ans = []
    for i in range(N-1,-1,-1):
        sumi = sum(ball[2*i+1::i+1])
        if a[i] != sumi%2:
            ball[i] = 1
            ans.append(i+1)
    ans.sort()
    print(len(ans))
    if len(ans) != 0:
        print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ball_ls = [0 for i in range(n)]
for i in range(n-1,-1,-1):
    if i == 0:
        ball_ls[i] = sum(a_ls)
    else:
        ball_ls[i] = sum(a_ls[1::(i+1)]) % 2
cnt = sum(ball_ls)
ball_ls = [str(i+1) for i, ball in enumerate(ball_ls) if ball > 0]
print(cnt)
if cnt > 0:
    print(" ".join(ball_ls))

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
1


Fixed submission (verdict: Accepted):
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ball_ls = [0 for i in range(n)]
for i in range(n-1,-1,-1):
    if i > n / 2 - 1:
        ball_ls[i] = a_ls[i]
    else:
        ball_ls[i] = (sum(ball_ls[i::(i + 1)]) + a_ls[i]) % 2
cnt = sum(ball_ls)
ball_ls = [str(i+1) for i, ball in enumerate(ball_ls) if ball > 0]
print(cnt)
if cnt > 0:
    print(" ".join(ball_ls))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n-1, -1, -1):
    if sum(a[i:n-1:i+1])%2==1:
        a[i]+=1
        ans.append(i+1)
a.sort()
print(len(ans))
print(*ans)

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
3 1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
res = [0]*n
ans = []
for i in range(n-1, -1, -1):
    if sum(res[i::i+1])%2!=a[i]:
        res[i] = 1
        ans.append(i+1)
a.sort()
print(len(ans))
print(*ans)

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

ball = [0] * N

for i in range(N-1, -1, -1) :
    bit = 0
    for j in range(1, N) :
        if i * j >= N :
            break
        bit = (bit + ball[i * j]) % 2
    ball[i] = bit % 2

print(*ball)

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
0 0 0 0 0


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

ball = [0] * N
ans = []

for i in range(1, N+1) :
    ballCount = sum(ball[N-i::N-i+1])
    if ballCount % 2 == A[N-i] :
        pass
    else :
        ball[N - i] = 1
        ans.append(N - i + 1)
print(len(ans))
print(*ans)

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

m = 0
b = []

for i in range(n-1, -1, -1):
    t = sum(a[i::i+1]) % 2
    if sum(a[i::i+1]) % 2 == 1:
        m += 1
        a[i] += 1
        b.append(i+1)

print(m)
print(*b)

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
3 1


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

m = 0
aa = [0] * n
b = []

for i in range(n-1, -1, -1):
    t = sum(aa[i::i+1]) % 2
    if t != a[i]:
        m += 1
        aa[i] += 1
        b.append(i+1)

print(m)
print(*b)

Problem: p02972
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())
A=["*"]+list(map(int,input().split()))
B=["*"]+list([0]*N)

for k in range(N,0,-1):
    p=0
    for i in range(k,N+1,k):
        p^=B[i]
    B[k]=p

C=[k for k in range(1,N+1) if B[k]]
print(len(C))
if len(C)!=0:
    print(" ".join(map(str,C)))

Failing test case input:
5
1 0 0 0 0

Expected output:
1
1


Actual output:
0


Fixed submission (verdict: Accepted):
N=int(input())
A=["*"]+list(map(int,input().split()))
B=["*"]+list([0]*N)

for k in range(N,0,-1):
    p=A[k]
    for i in range(2*k,N+1,k):
        p^=B[i]
    B[k]=p

C=[k for k in range(1,N+1) if B[k]]
print(len(C))
if C:
    print(" ".join(map(str,C)))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N=int(input())
a=list(map(int, input().split()))

H=math.floor(N / 2) 
B=a[H:N]

for i in range(H-1,-1,-1):
    s = 0
    j = i
    while j < N:
        s+=a[j]
        j+=(i+1)
    B.insert(0, s % 2)

ans = [i + 1 for i, x in enumerate(B) if x == 1]
l = len(ans)
print(l)
if (l > 0):
    print(*ans)


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


Fixed submission (verdict: Accepted):
import math

N=int(input())
a=list(map(int, input().split()))
B=a[:]

for i in range(N-1,-1,-1):
    s = 0
    j = i
    j+=(i+1)
    while j < N:
        s+=B[j]
        j+=(i+1)
    m = s % 2
    B[i] = a[i] ^ m

ans = [i + 1 for i, x in enumerate(B) if x == 1]
l = len(ans)
print(l)
if (l > 0):
    print(*ans)

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

ans = [0] * N
for i in range(N,0,-1):
    ts = sum(ans[i:N:i])
    if ts % 2 != A[i-1]: ans[i-1] = 1

print(sum(ans))
for i in range(N):
    if ans[i] == 1: print(i+1,end=' ')
print()

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
3
1 3 4 


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

ans = [0] * N
for i in range(N,0,-1):
    ts = sum(ans[i-1:N:i])
    if ts % 2 != A[i-1]: ans[i-1] = 1

print(sum(ans))
for i in range(N):
    if ans[i] == 1: print(i+1,end=' ')
print()

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
e=0
for i in range(n):
    c=n-i
    d=0
    while c<=n:
        b[c-1]+=d
        c+=(n-i)
    if d%2!=a[n-i-1]:
        b[-i-1]+=1
        e+=1
print(e)
for i in range(n):
    if b[i]!=0:
        print(i+1,end=' ')

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
1 3 

Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
e=0
for i in range(n):
    c=n-i
    d=0
    while c<=n:
        d+=b[c-1]
        c+=(n-i)
    if d%2!=a[n-i-1]:
        b[-i-1]+=1
        e+=1
print(e)
for i in range(n):
    if b[i]!=0:
        print(i+1,end=' ')

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

for i in range(N-1,-1,-1):
  a = A[i]
  for j in range(i+1,N-1,i+1):
    if j in ans:
      a += 1
  if a % 2:
    ans.add(i+1)
print(len(ans))
print(*ans)

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
2 4


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

for i in range(N-1,-1,-1):
  a = A[i]
  for j in range(i+1,N+1,i+1):
    if j in ans:
      a += 1
  if a % 2:
    ans.add(i+1)
print(len(ans))
print(*ans)
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [0] + list(map(int, input().split()))
ans = set()
b = [0] * (n + 1)
for i in range(n, 0, - 1):
    cnt = 0
    for j in range(i + i, n + 1, i):
        cnt += a[j]
    cnt %= 2
    b[i] = a[i] - cnt
    if b[i] :
        ans.add(i)
print(len(ans))
print(*ans)

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


Fixed submission (verdict: Accepted):
n = int(input())
a = [0] + list(map(int, input().split()))
ans = set()
b = [0] * (n + 1)
for i in range(n, 0, - 1):
    cnt = 0
    for j in range(i, n + 1, i):
        cnt += b[j]
    cnt %= 2
    b[i] = (a[i] % 2) - cnt
    if b[i] :
        ans.add(i)
print(len(ans))
print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N = int(input())
a = list(map(int,input().split()))
b = [0] * N

for i in reversed(range(N)):
        x = math.ceil(N/(i+1))
        temp = 0
        for k in range(x):
            temp = temp + b[k*(i+1)-1]
        if a[i] != (temp%2):
            b[i] = 1
M = b.count(1)
print(M)
if M != 0:
    for i in range(N):
        if b[i] ==1:
            print(str(i+1) + " ")

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
3
3 
4 
5 


Fixed submission (verdict: Accepted):
import math

N = int(input())
a = list(map(int,input().split()))
b = [0] * N

for i in reversed(range(N)):
    x = math.floor(N/(i+1))
    temp = 0
    for k in range(1,x+1):
        temp += b[k*(i+1) - 1]
    if a[i] != (temp%2):
        b[i] = 1
M = b.count(1)
print(M)
if M != 0:
    for i in range(N):
        if b[i] ==1:
            print(str(i+1), end = " ")

Problem: p02972
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

b = [-1] * n
for i in range(n, 0, -1):
    cnt = sum(b[j] for j in range(i + i, n, i))
    b[i - 1] = int(a[i - 1] != cnt % 2)

print(sum(b))
if sum(b) > 0:
    print(*[i+1 for i in range(n) if b[i] == 1])


Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
2 5


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

b = [-1] * n
for i in range(n, 0, -1):
    cnt = sum(b[j - 1] for j in range(i + i, n + 1, i))
    b[i - 1] = int(a[i - 1] != cnt % 2)

print(sum(b))
if sum(b) > 0:
    print(*[i + 1 for i in range(n) if b[i] == 1])

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))
b = [-1]*N
d = 1
r = []
for i in range(N, 0, -1):
  m = 0
  c = 2*i
  while c <= N:
    m += a[c-1]
    c += i
  if m % 2 == a[i-1]:
    b[i-1] = 0
  else:
    b[i-1] = 1
    r.append(i)
print(sum(b))
print(" ".join([str(s) for s in r]))

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
4 1


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))
b = [0]*N
d = 1
r = []
for i in range(N, 0, -1):
  m = 0
  c = 2*i
  while c <= N:
    m += b[c-1]
    c += i
  if m % 2 != a[i-1]:
    b[i-1] = 1
    r.append(i)
print(sum(b))
print(" ".join([str(s) for s in r]))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[0]+list(map(int,input().split()))
b=[0]*(n+1)
for i in reversed(range(1,n+1)):
    if sum(b[i::i])%2!=a[i]:
        b[i]=1
print(sum(b))
for i in range(n):
    if b[i]==1:
        print(b[i],end=' ')

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
a=[0]+list(map(int,input().split()))
b=[0]*(n+1)
for i in reversed(range(1,n+1)):
    if sum(b[i::i])%2!=a[i]:
        b[i]=1
print(sum(b))
for i,j in enumerate(b):
    if j==1:
        print(i,end=' ')

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(i) for i in input().split()]


def input(p):
    s = 0
    for i in range(N):
        if i+1 % p == 0:
            s += a[i]
    return s


b = []
for i in range(1, N + 1):
    if input(i) % 2 != a[i-1]:
        print("-1")
        exit()
    if a[i-1] == 1:
        b.append(i)

M = sum(b)
print(M)
ans = ' '.join(map(str, b))
print(ans)

Failing test case input:
5
1 1 0 0 0

Expected output:
1
2


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(i) for i in input().split()]
b = [0 for i in range(N)]
c = []


for i in range(N-1, -1, -1):
    for j in [0, 1]:
        b[i] = j
        if sum(b[i::i+1]) % 2 == a[i]:
            break
    else:
        print("-1")
        exit()

M = sum(b)
print(M)

for index, value in enumerate(b):
    if value == 1:
        c.append(index + 1)

ans = ' '.join(map(str, c))
print(ans)

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

N=int(input())
A=list(map(int,input().split()))
Box=[0 for i in range(N)]
BoxNum=[]

for l in reversed(range(1,N+1)):
    Incount=0
    for m in range(1,int(N/l)):
        Incount+=Box[l*m]
    if Incount%2!=A[l-1]:
        Box[l-1]+=1
        BoxNum.append(l)

print(len(BoxNum))
if len(BoxNum)!=0:
    print(" ".join(map(str,BoxNum)))

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
3
3 2 1


Fixed submission (verdict: Accepted):


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

check=[0 for i in range(N)]
M=0
b=[]
for j in reversed(range(1,N+1)):
    total=0
    for k in range(1,int(N/j)+1):
        total+=check[int(j*k)-1]
    if a[j-1]!=total%2:
        M+=1
        check[j-1]=1
        b.append(j)

print(M)
for l in range(len(b)):
    print(b[l],end=' ')
else:
    print()
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.insert(0, 1e10)
    ans = []
    for i in range(len(A) - 1, 0, -1):
        idx = i
        s = 0
        while idx <= len(A) - 1:
            s += A[idx]
            idx += i

        if s % 2 != 0:
            ans.append(i)
    
    if len(ans) > 0:
        print(*ans)
    else:
        print(0)


if __name__ == '__main__':
    main()


Failing test case input:
5
1 0 0 0 0

Expected output:
1
1


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.insert(0, 1e10)
    ans = []
    B = [0] * len(A)
    for i in range(len(A)-1, 0, -1):
        idx = i
        s = 0
        while idx <= len(A) - 1:
            s += B[idx]
            idx += i

        if s % 2 != A[i]:
            ans.append(i)
            B[i] = 1

    
    if len(ans) > 0:
        print(len(ans))
        print(*ans)
    else:
        print(0)


if __name__ == '__main__':
    main()

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

ans = []
for i in range(n):
    ans.append(0)

for i in range(n-1, -1, -1):
    ans[i] = sum(a[i::i+1]) % 2

print(ans.count(1))
for i in range(n):
    if ans[i] != 0:
        print(i+1, "", end="")


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4 

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

ans = []
for i in range(n):
    if i < n
        ans.append(0)
    else:
        ans.append(a[i])

for i in range(n
    ans[i] = (a[i] + sum(ans[i::i+1])) % 2

print(ans.count(1))
for i in range(n):
    if ans[i] != 0:
        print(i+1, "", end="")

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))
box = [0 for _ in range(N + 1)]
ans = []
for i in range(1, N + 1)[:: -1]:
    k = 1
    my_sum = 0
    while i * k <= N: 
        my_sum += box[i * k]
        k += 1
    if my_sum % 2 != a[i - 1]:
        box[i] = 1
        ans.append(i)
if len(ans) > 0:
    print(" ".join(map(str, ans)))
else:
    print(0)

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
5


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))
box = [0 for _ in range(N + 1)]
ans = []
for i in range(1, N + 1)[:: -1]:
    k = 1
    my_sum = 0
    while i * k <= N: 
        my_sum += box[i * k]
        k += 1
    if my_sum % 2 != a[i - 1]:
        box[i] = 1
        ans.append(i)
if len(ans) > 0:
    print(len(ans))
    print(" ".join(map(str, ans)))
else:
    print(0)
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [0] + list(map(int,input().split()))

hako = [0]*(N+1)

for i in range(N, 0, -1):
    cnt = 0
    j = i
    while j <= N:
        cnt += hako[j]
        j += j
    
    if cnt%2 != A[i]:
        hako[i] = 1

print(hako.count(1))
s = ""
for i, x in enumerate(hako):
    if x == 1:
        s += str(i) + " "

print(s)

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
1 3 


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

hako = [0]*(N+1)

for i in range(N, 0, -1):
    cnt = 0
    j = i
    x = j
    while j <= N:
        cnt += hako[j]
        j += x
    
    if cnt%2 != A[i]:
        hako[i] = 1


print(hako.count(1))
s = ""
for i, x in enumerate(hako):
    if x == 1:
        s += str(i) + " "

print(s)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(i) for i in input().split(" ")]

sum_index = [0]*(N+1)
index = []
for i in range(N)[::-1]:
    sum_ = 0
    for j in sum_index[i+1::i+1]:
        sum_ ^= j
    sum_index[i+1] = sum_ ^ A[i]
    if sum_index[i+1] == 1:
        index.append(str(i))
print(sum(sum_index))
print(" ".join(index))

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
1
2


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(i) for i in input().split(" ")]

sum_index = [0]*(N+1)
index = []
for i in range(N)[::-1]:
    sum_ = 0
    for j in sum_index[i+1::i+1]:
        sum_ ^= j
    sum_index[i+1] = sum_ ^ A[i]
    if sum_index[i+1] == 1:
        index.append(str(i+1))

print(sum(sum_index))
if index:
    print(" ".join(index))

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [0] + list(map(int, input().split()))
ans = set()
b = [0] * (n + 1)
for i in range(n, 0, - 1):
    cnt = 0
    for j in range(i + i, n + 1, i):
        cnt += a[j]
    cnt %= 2
    b[i] = (a[i] % 2) - cnt
    if b[i] :
        ans.add(i)
print(len(ans))
print(*ans)

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


Fixed submission (verdict: Accepted):
n = int(input())
a = [0] + list(map(int, input().split()))
ans = set()
b = [0] * (n + 1)
for i in range(n, 0, - 1):
    cnt = 0
    for j in range(i, n + 1, i):
        cnt += b[j]
    cnt %= 2
    b[i] = (a[i] % 2) - cnt
    if b[i] :
        ans.add(i)
print(len(ans))
print(*ans)
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

n = int(stdin.readline().rstrip())
li = [0] + list(map(int,stdin.readline().rstrip().split()))
lin = []
point = 0

for i in range(n,0,-1):
    goukei = sum(li[i::i])%2
    if goukei != li[i]:
        point += 1
        lin.append(i)
print(point)
lin.sort()
for i in lin:
    print(i)

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
1
1


Fixed submission (verdict: Accepted):
from sys import stdin

n = int(stdin.readline().rstrip())
li = [0] + list(map(int,stdin.readline().rstrip().split()))
lin = [0]*(n+1)
point = 0
lis = []

for i in range(n,0,-1):
    su = sum(lin[i::i])%2
    if li[i] != su:
        lin[i] = 1
        point += 1
        lis.append(i)
    
print(point)
lis.sort()

for i in lis:
    print(i)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ai = [int(x) for x in input().split()]
bn = [0] * n

for i in range(0,n):
    j = n - 1 - i
    c = 0
    for k in range(1, n):
        if k * j >= n-1:
            break
        c += bn[j*k]
    
    bn[j] = (c + ai[j]) & 1


m = sum(bn)
print(m)
for i in range(0,n):
    if bn[i] == 1:
        print(i+1, end=" ")



Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4 

Fixed submission (verdict: Accepted):
n = int(input())
ai = [int(x) for x in input().split()]
bn = [0] * n

for i in range(0,n):
    j = n - 1 - i
    c = 0
    for k in range(2, n+1):
        idx = k * (j + 1) - 1
        if  idx > n-1:
            break
        c += bn[idx]
    
    bn[j] = (c + ai[j]) % 2


m = sum(bn)
print(m)
for i in range(0,n):
    if bn[i] == 1:
        print(i+1, end=" ")

Problem: p02972
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

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

m = 0
ans = [0]*N
for i in range(N, 0, -1):
    a = A[i-1]
    cnt = 0
    for k in range(i+i, N+1, i):
        cnt += A[k-1]
    if a != cnt % 2:
        ans[i-1] = 1
        m += 1

print(m)
for an in ans:
    if an > 0:
        print(an, end=' ')
print()


Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
1
1 


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

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

m = 0
ans = [0]*N
for i in range(N, 0, -1):
    a = A[i-1]
    cnt = 0
    for k in range(i+i, N+1, i):
        cnt += ans[k-1]
    if a != cnt % 2:
        ans[i-1] = 1
        m += 1

print(m)
for i in range(N):
    if ans[i] > 0:
        print(i+1, end=' ')
print()
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
A = list(map(int, input().split()))
B = set()

for i in list(range(1, N+1))[::-1]:
  tmp = i
  cnt = 0
  while tmp < N:
    if tmp in B:
      cnt += 1    
    tmp += i

  if cnt % 2 != A[i-1]:
    B.add(i)

len_b = len(B)
if len_b == 0:
  print(0)
else:
  print(len_b)
  print(*sorted(list(B)))

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
1 5


Fixed submission (verdict: Accepted):

N = int(input())
A = list(map(int, input().split()))
B = set()

for i in list(range(1, N+1))[::-1]:
  tmp = i
  cnt = 0
  while tmp <= N:
    if tmp in B:
      cnt += 1    
    tmp += i

  if cnt % 2 != A[i-1]:
    B.add(i)

len_b = len(B)
if len_b == 0:
  print(0)
else:
  print(len_b)
  print(*sorted(list(B)))

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

N = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
A = [0] + a
B = [0]*(N+1)
putBall = []

for i in range(N, 0, -1):
    cnt = 1
    multiple = i
    tmp = 0
    while multiple <= N:
        tmp += B[multiple]
        cnt += 1
        multiple *= cnt
    B[i] = (tmp + A[i])%2
    if B[i] == 1:
        putBall.append("%d" % i)

print(sum(B))
print(*putBall)

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
5 1


Fixed submission (verdict: Accepted):
from sys import stdin

N = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
A = [0] + a
B = [0]*(N+1)
putBall = []

for i in range(N, 0, -1):
    cnt = 1
    multiple = i
    tmp = 0
    if sum(B[i::i])%2 != A[i]:
        B[i] = 1
        putBall.append("%d" % i)

print(sum(B))
print(*putBall)

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

ans = [0] * n

for i in reversed(range(1, n+1)):
    count = 0
    for j in range(i+1, n+1, i):
        count += ans[j-1]

    if count % 2 != a[i-1]:
        ans[i-1] = 1

for _ans in ans:
    print(_ans)


Failing test case input:
5
0 0 0 0 0

Expected output:
0

Actual output:
0
0
0
0
0


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

ans = [0] * n

for i in reversed(range(1, n+1)):
    count = 0
    for j in range(2 * i, n + 1, i):
        count += ans[j-1]

    if count % 2 != a[i-1]:
        ans[i-1] = 1

print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i + 1)
Problem: p02972
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

b = [-1] * n
for i in range(n, 0, -1):
    cnt = sum(b[i] for i in range(i + i, n, i))
    b[i - 1] = int(a[i - 1] != cnt % 2)

print(sum(b))
if sum(b) > 0:
    print(*[i for i in b if i == 1])


Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
1 1


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

b = [-1] * n
for i in range(n, 0, -1):
    cnt = sum(b[j - 1] for j in range(i + i, n + 1, i))
    b[i - 1] = int(a[i - 1] != cnt % 2)

print(sum(b))
if sum(b) > 0:
    print(*[i + 1 for i in range(n) if b[i] == 1])
Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

lst = []

for i in range(N):
    lst.append(int(input()))

lst.sort(reverse=True)

lst2 = [ i / 10 for i in lst if i % 10 != 0 ]
p_list = []

if len(lst2) == 0:
    print(0)
else:
    for i in range(N):
        for j in range(N):
            if i > N-j :
                break
            else:
                print(lst[i:N-j])
                ans = sum(lst[i:N-j])
                if ans % 10 != 0:
                    print(ans)
                    exit(0)


Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
[15, 10, 5]
[15, 10]
25


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

lst = []

for i in range(N):
    lst.append(int(input()))

lst.sort()
lstsum = sum(lst)
p_list = [ i / 10 for i in lst if i % 10 != 0 ]

if len(p_list) == 0:
    print(0)
elif lstsum % 10 != 0:
    print(lstsum)
else:
    for i in range(N):
        ans = lstsum - lst[i]
        if ans % 10 != 0:
            print(ans)
            exit(0)
Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
for i in range(N):
	if sum % 10 != 0:
		print(sum)
		break
	else:
		for j in range(N):
			if s[j] % 10 != 0:
				print(sum - s[j])
				check == 1
				break

if check == 0:
	print(0)



Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
25
25
25
0


Fixed submission (verdict: Accepted):


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
if sum % 10 != 0:
	print(sum)
else:
	for i in range(N):
		if s[i] % 10 != 0:
			print(sum - s[i])
			break
		else:
			check = check + 1

if check == N:
	print(0)

Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

N = int(input())
s = list()
for i in range(N):
	s.append(int(input()))

s.sort(reverse=True)

print(s)

point = sum(s)
l = len(s)
i = 0

while i < l:
	if point % 10 != 0:
		print(point)
		sys.exit()
	if not s == []:
		for x in reversed(list(s)):
			if not x % 10 == 0:
				point -= s.pop(s.index(x))
				break
	i += 1

print("0")

Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
[15, 10, 5]
25


Fixed submission (verdict: Accepted):
import sys

N = int(input())
s = list()
for i in range(N):
	s.append(int(input()))

s.sort(reverse=True)

point = sum(s)
l = len(s)
i = 0

while i < l:
	if point % 10 != 0:
		print(point)
		sys.exit()
	if not s == []:
		for x in reversed(list(s)):
			if not x % 10 == 0:
				point -= s.pop(s.index(x))
				break
	i += 1

print("0")

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


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
if sum % 10 != 0:
	print(sum)
else:
	for j in range(N):
		if s[j] % 10 != 0:
			print(sum - s[j])
			check == 1
			break

if check == 0:
	print(0)



Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
25
0


Fixed submission (verdict: Accepted):


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
if sum % 10 != 0:
	print(sum)
else:
	for i in range(N):
		if s[i] % 10 != 0:
			print(sum - s[i])
			break
		else:
			check = check + 1

if check == N:
	print(0)

Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
*s, = sorted([int(input()) for _ in range(n)], reverse=True)

ans = sum(s)
if ans%10 == 0:
    for _s in s:
        if _s%10 != 0:
            print(ans-_s)
            quit()
    print(0)
else:
    print(ans)


Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
15


Fixed submission (verdict: Accepted):
n = int(input())
*s, = sorted([int(input()) for _ in range(n)])

ans = sum(s)
if ans%10 == 0:
    for _s in s:
        if _s%10 != 0:
            print(ans-_s)
            quit()
    print(0)
else:
    print(ans)
Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n, *lst = map(int, sys.stdin.read().split())
res = sum(lst)
if not res % 10:
  tmp = [i for i in lst if not i % 10]
  if tmp:
    res -= min(tmp)
  else:
    res = 0
print(res)
  


Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
20


Fixed submission (verdict: Accepted):
import sys
n, *lst = map(int, sys.stdin.read().split())
res = sum(lst)
if not res % 10:
  tmp = [i for i in lst if i % 10]
  if tmp:
    res -= min(tmp)
  else:
    res = 0
print(res)

Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
s=[int(input()) for _ in range(N)]
def cal(S,items):
    if(S&10!=0):
        return S
    temp=100000000
    for i in items:
        if(i%10!=0):
            temp=min(i,temp)
    return S-temp if(S-temp>0) else 0
print(cal(sum(s),s))

Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
30


Fixed submission (verdict: Accepted):
N=int(input())
s=[int(input()) for _ in range(N)]
def cal(S,items):
    if(S%10!=0):
        return S
    temp=100000000
    for i in items:
        if(i%10!=0):
            temp=min(i,temp)
    return S-temp if(S-temp>0) else 0
print(cal(sum(s),s))

Problem: p03701
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
s = [int(input()) for i in range(n)]
ans = sum(s)
s.sort()
s = s[::-1]
if ans %10 != 0:
  print(ans)
else:
  for i in s:
    if (ans -i) %10 != 0:
      print(ans-i)
      break
  else:
    print(0)

Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
15


Fixed submission (verdict: Accepted):
n = int(input())
s = [int(input()) for i in range(n)]
ans = sum(s)
s.sort()
if ans %10 != 0:
  print(ans)
else:
  for i in s:
    if (ans -i) %10 != 0:
      print(ans-i)
      break
  else:
    print(0)

Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
Ss = [int(input()) for _ in range(N)]
Ss.sort()
ans = sum(Ss)
if ans % 10 != 0:
    print(ans)
    exit()
cnt_10 = 0
for s in Ss:
    if s != 10:continue
    ans -= s
    if ans % 10 != 0:
        print(ans)
        exit()
print(0)

Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
0


Fixed submission (verdict: Accepted):

N = int(input())
Ss = [int(input()) for _ in range(N)]
Ss.sort()
ans = sum(Ss)
if ans % 10 != 0:
    print(ans)
    exit()
cnt_10 = 0
for s in Ss:
    if s % 10 == 0:continue
    ans -= s
    if ans % 10 != 0:
        print(ans)
        exit()
print(0)
Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readAll_int(): return list(map(int, stdin))

    
def main():
    n = int(input())
    s = sorted(readAll_int())
    ans = sum(s)
     
    if ans % 10 == 0:
        for i in range(n):
            if i % 2 != 0:
                ans -= s[i]
        if ans % 10 != 0:
            print(ans)
        else:
            print(0)
    else:
        print(ans)
    
if __name__ == "__main__":
    main()
    

Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
0


Fixed submission (verdict: Accepted):
from sys import stdin
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readAll_int(): return list(map(int, stdin))

    
def main():
    n = int(input())
    s = sorted(readAll_int())
    ans = sum(s)
     
    if ans % 10 == 0:
        for i in range(n):
            if s[i] % 2 != 0:
                ans -= s[i]
                break
        if ans % 10 != 0:
            print(ans)
        else:
            print(0)
    else:
        print(ans)
    
if __name__ == "__main__":
    main()

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


N = int(input())
s = [input() for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + int(s[i])

j = 0
for i in range(N+1):
	if sum % 10 != 0:
		print("answer: " + str(sum))
		break
	elif j < N:
		sum = sum - int(s[j])
		j = j + 1
	else:
		print("answer: " + "0")


Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
answer: 5


Fixed submission (verdict: Accepted):


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
if sum % 10 != 0:
	print(sum)
else:
	for i in range(N):
		if s[i] % 10 != 0:
			print(sum - s[i])
			break
		else:
			check = check + 1

if check == N:
	print(0)

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

n = int(input())
s = []
for _ in range(n):
    s.append(int(input()))
s.sort()
a = sum(s)

if a%10!=0:
    print(a)
    exit()

for i in range(n):
    if s[i]%10:
        continue
    a -= s[i]
    if a%10!=0:
        print(a)
        exit()

print(0)


Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
0


Fixed submission (verdict: Accepted):

n = int(input())
s = []
for _ in range(n):
    s.append(int(input()))
s.sort()
a = sum(s)

if a%10!=0:
    print(a)
    exit()

for i in range(n):
    if s[i]%10==0:
        continue
    a -= s[i]
    if a%10!=0:
        print(a)
        exit()

print(0)
Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + int(s[i])

j = 0
for i in range(N+1):
	if sum % 10 != 0:
		print("answer: " + str(sum))
		break
	elif j < N:
		sum = sum - int(s[j])
		j = j + 1
	elif sum == 0:
		print("answer: " + "0")


Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
answer: 25


Fixed submission (verdict: Accepted):


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
if sum % 10 != 0:
	print(sum)
else:
	for i in range(N):
		if s[i] % 10 != 0:
			print(sum - s[i])
			break
		else:
			check = check + 1

if check == N:
	print(0)

Problem: p03701
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

N=int(input())
S=[int(input()) for _ in range(N)]
S.sort()

ans=sum(S)

if ans%10!=0:
  print(ans)
  sys.exit()
else:
  for i in range(N):
    if S[i]%10!=0:
      print(ans-S[i])
  else:
    print(0)

Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
25
15
0


Fixed submission (verdict: Accepted):
import sys
 
N=int(input())
S=[int(input()) for _ in range(N)]
S.sort()
 
ans=sum(S)
 
if ans%10!=0:
  print(ans)
  sys.exit()
else:
  for i in range(N):
    if S[i]%10!=0:
      print(ans-S[i])
      sys.exit()
  else:
    print(0)

Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

N = int(input())
s = list()
for i in range(N):
	s.append(int(input()))

s.sort(reverse=True)

print(s)

point = sum(s)
l = len(s)
i = 0

while i < 1:
	if point % 10 != 0:
		print(point)
		sys.exit()
	if not s == []:
		point -= s.pop()
	i += 1

print("0")

Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
[15, 10, 5]
0


Fixed submission (verdict: Accepted):
import sys

N = int(input())
s = list()
for i in range(N):
	s.append(int(input()))

s.sort(reverse=True)

point = sum(s)
l = len(s)
i = 0

while i < l:
	if point % 10 != 0:
		print(point)
		sys.exit()
	if not s == []:
		for x in reversed(list(s)):
			if not x % 10 == 0:
				point -= s.pop(s.index(x))
				break
	i += 1

print("0")

Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

N = int(input())
s = list()
for i in range(N):
	s.append(int(input()))

s.sort(reverse=True)

point = sum(s)
l = len(s)
i = 0

while i < 1:
	if point % 10 != 0:
		print(point)
		sys.exit()
	if not s == []:
		point -= s.pop()
	i += 1

print("0")

Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
0


Fixed submission (verdict: Accepted):
import sys

N = int(input())
s = list()
for i in range(N):
	s.append(int(input()))

s.sort(reverse=True)

point = sum(s)
l = len(s)
i = 0

while i < l:
	if point % 10 != 0:
		print(point)
		sys.exit()
	if not s == []:
		for x in reversed(list(s)):
			if not x % 10 == 0:
				point -= s.pop(s.index(x))
				break
	i += 1

print("0")
Problem: p03701
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N = int(input())
s = [input() for i in range(N)]
s.sort

sum = 0
for i in range(N):
	sum = sum + int(s[i])

j = 0
for i in range(N+1):
	if sum % 10 != 0:
		print("answer: " + str(sum))
		break
	elif j < N:
		sum = sum - int(s[j])
		j = j + 1
	else:
		print("answer: " + "0")


Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
answer: 25


Fixed submission (verdict: Accepted):


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
if sum % 10 != 0:
	print(sum)
else:
	for i in range(N):
		if s[i] % 10 != 0:
			print(sum - s[i])
			break
		else:
			check = check + 1

if check == N:
	print(0)

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


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
for i in range(N):
	if sum % 10 != 0:
		print(sum)
		break
	else:
		for j in range(N):
			if s[j] % 10 != 0:
				print(sum - s[j])
				check == 1

if check == 0:
	print(0)



Failing test case input:
3
5
10
15

Expected output:
25

Actual output:
25
15
25
15
25
15
0


Fixed submission (verdict: Accepted):


N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
if sum % 10 != 0:
	print(sum)
else:
	for i in range(N):
		if s[i] % 10 != 0:
			print(sum - s[i])
			break
		else:
			check = check + 1

if check == N:
	print(0)
Problem: p03072
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
sum=1
temp=a[0]
for i in range(n-1):
  if temp<a[i+1]:
    temp=a[i+1]
    sum+=1
print(sum)

Failing test case input:
5
4 4 3 3 4

Expected output:
3


Actual output:
1


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

Problem: p03072
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

n = ni()
h = na()

c = 1
maxh = h[0]
for i in range(n-1):
    if maxh <= h[i+1]:
        c += 1
        maxh = h[i]


print(c)


Failing test case input:
5
1 0 0 7 2

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

n = ni()
h = na()

c = 1
maxh = h[0]
for i in range(n-1):
    if maxh <= h[i+1]:
        c += 1
        maxh = h[i+1]

print(c)

Problem: p03072
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int, input().split()))
cnt = 1

for i in range(1,n):

    if h[i] > max(h[:i]):
        cnt += 1

print(cnt)

Failing test case input:
5
1 5 3 2 5

Expected output:
3


Actual output:
2


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

for i in range(1,n):

    if h[i] >= max(h[:i]):
        cnt += 1

print(cnt)

Problem: p03072
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
hs = input().split()
count = 1
maxh = 0
for i in range(1,n):
    maxh = max(maxh, int(hs[i-1]))
    if int(hs[i])>maxh:
        count += 1
print(count)

Failing test case input:
5
3 3 6 1 0

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
hs = input().split()
count = 1
maxh = 0
for i in range(1,n):
    maxh = max(maxh, int(hs[i-1]))
    if int(hs[i])>=maxh:
        count += 1
print(count)

Problem: p03072
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = [int(i) for i in input().split()]
maxh,c = 0,0
for i in h:
  if i >= maxh:
    c += 1
print(c)
    



Failing test case input:
4
76 -1 -1 3

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
h = [int(i) for i in input().split()]
maxh,c = 0,0
for i in h:
  maxh = max(maxh,i)
  if i >= maxh:
    c += 1
    
print(c)