Problem p02972 (python)

Fixed submission:
def main():
    n = int(input())
    A = [0] + list(map(int, input().rstrip().split()))
    for i in range(n // 2, 0, -1):  # second half: no multiples
        A[i] = sum(A[i::i]) % 2
    ans = [i for i, j in enumerate(A) if j]
    print(len(ans))  # all cells: [1] -> len() (much faster than sum())
    print(*ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = [0] + map(int, input().split(' ')) #ずらしておく。
for i in range(N//2, 0, -1):
  arr[i] = sum(arr[i::i]) % 2
ans = [i for i, j in enumerate(arr) if j == 1]
print(len(ans))
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
for i in range(N//2, 0, -1):
  arr[i] = sum(arr[i::i]) % 2
ans = [i for i, j in enumerate(arr) if j == 1]
print(len(ans))
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split())
for i in range(N//2, 0, -1):
  arr[i] = sum(arr[i::i]) % 2
ans = [i for i, j in enumerate(arr) if j == 1]
print(len(ans))
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split())
for i in range(n//2, 0, -1): # n // 2 より大きい場合はarrの値そのままでよい。
  arr[i] = sum(arr[i::i]) % 2 # それ以外はパリティをあわせる。
ans = [i for i, j in enumerate(arr) if j == 1]
print(len(ans))
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split())
for i in range(n//2, 0, -1): # n // 2 より大きい場合はarrの値そのままでよい。
  arr[i] = sum(arr[i::i]) % 2 # それ以外はパリティをあわせる。
  ans = [i for i, j in enumerate(arr) if j == 1]
print(len(ans))
print(*ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
arr=map(int, input().split())
for i in range(N,0,-1):
    arr[i-1] = sum(arr[i-1::i]) % 2
print(sum(arr))
print(' '.join([str(i+1) for i,j in enumerate(arr) if j == 1]))

Buggy submission (verdict: Runtime Error):
N=int(input())
arr=map(int, input().split())
for i in range(n,0,-1):
    arr[i-1] = sum(arr[i-1::i]) % 2
print(sum(arr))
print(' '.join([str(i+1) for i,j in enumerate(arr) if j == 1]))

Buggy submission (verdict: Runtime Error):
N=int(input())
arr=map(int, input().split())
for i in range(n,0,-1):
    arr[i-1] = sum(arr[i-1::i]) % 2
print(sum(a))
print(' '.join([str(i+1) for i,j in enumerate(arr) if j == 1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N)):
  n = i + 1
  s = 0
  for k in reversed(range(1, N // n)):
	index = n*(k+1) - 1
	s += arr[index]
  if s % 2 == arr[i]:
     ans[i] = 0
  else:
     ans[i] = 1
    	
ans_arr = []
for i in ans:
  if i == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N)):
  n = i + 1
  s = 0
  for k in reversed(range(1, N // n)):
	index = n*k - 1
	s += arr[index]
  if s % 2 == arr[i]:
     ans[i] = 0
  else:
     ans[i] = 1
    	
ans_arr = []
for i in ans:
  if i == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N)):
  n = i + 1
  if n > N/2.0:
    ans[i] == arr[i]:
  else:
    s = 0
  	for k in reversed(range(1, N // n)):
    	index = n*k - 1
        s += arr[index]
    if s % 2 == arr[i]:
      ans[i] = 0
    else:
      ans[i] = 1
    	
ans_arr = []
for i in ans:
  if i == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N)):
  n = i + 1
  if n > N/2.0:
    ans[i] == arr[i]:
  else:
    s = 0
  	for k in reversed(range(1, N // n)):
    	index = n*k - 1
        s += arr[index]
    if s % 2 == arr[i]:
      ans[i] = 0
    else:
      ans[i] = 1
    	
ans_arr = []
for i in ans:
  if ans == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N)):
  n = i + 1
  if i > N/2.0:
    ans[i] == 0:
  else:
    s = 0
  	for k in reversed(range(1, N // n)):
    	index = n*k - 1
        s += arr[index]
    if s % 2 == arr[i]:
      ans[i] = 0
    else:
      ans[i] = 1
    	
ans_arr = []
for i in ans:
  if ans == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N)):
  n = i + 1
  if i > N/2.0:
    ans[i] == 0:
  else:
    s = 0
  	for k in reversed(range(1, N // n)):
    	index = n*k - 1
        s += arr[index]
    if s % 2 == arr[i]:
      arr[i] = 0
    else:
      arr[i] = 1
    	
ans_arr = []
for i in ans:
  if ans == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N))
	if (i+1) > N/2.0:
    	ans[i] = arr[i]
    else:
      sum_v = 0
      for k in range(N//(i+1)):
        index = (k+1) * (i+1)
        sum_v += ans[index]
      if sum_v % 2 == arr[i]:
        ans[i] = 0
      else:
		ans[i] = 1
ans_arr = []
for i in ans:
  if ans == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N))
	if (i+1) > N/2.0:
    	ans[i] = arr[i]
    else:
      sum_v = 0
      for k in range(N//(i+1)):
        index = (k+1) * (i+1)
        sum_v += ans[index]
      if sum_v % 2 == arr[i]:
        ans[i] = 0
      else:
		ans[i] = 1
ans_arr = []
for i in ans:
  if ans == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = []
for i, num in enumerate(arr)
	if num == 1:
    	ans.append(i+1)
print(sum(arr))
print(' '.join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = []
for i, num in enumerate(arr)
	if num == 1:
    	ans.append(i+1)
print(' '.join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split(' '))
ans = []
for i, num in enumerate(arr)
	if num != 0:
    	ans.append(i+1)
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = map(input().split(' '))
ans = []
for i, num in enumerate(arr)
	if num != 0:
    	ans.append(i+1)
print(''.join(ans))