Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
if n ==1:
    print("Hello World")
elif n ==2:
    print(a+b)

Fixed submission:
n=int(input())
if n ==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
if n ==1:
    print("Hello World")
else:
    print(a+b)

Fixed submission:
n=int(input())
if n ==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
A,B,K =(map(int,input().split()))
TL = list(range(A,B+1))
L = [i for i in TL if ((i>=A) and i<=A+K-1)] 
LU =  [i for i in TL if  ((i>=B-K+1) and i<=B)] 
#L.append( [i for i in TL if ((i<=B) and (i>=B-K))])
LL = set(L + LU)
for i in LL:
    print(i)

Fixed submission:
a, b, k = map(int,input().split())
for i in range(a, min(a + k, b + 1)):
    print(i)
for i in range(max(b - k + 1, a + k), b + 1):
    print(i)

Buggy python submission (verdict: Runtime Error):
A,B,K =(map(int,input().split()))
TL = list(range(A,B+1))
L = [i for i in TL if ((i>=A) and i<=A+K-1)] 
LU =  [i for i in TL if  ((i>=B-K+1) and i<=B)] 
#L.append( [i for i in TL if ((i<=B) and (i>=B-K))])
LL = set(L + LU)
for i in LL:
    print(i)

Fixed submission:
a, b, k = map(int,input().split())
for i in range(a, min(a + k, b + 1)):
    print(i)
for i in range(max(b - k + 1, a + k), b + 1):
    print(i)
Buggy python submission (verdict: Runtime Error):
s=str(input())
s[3]="8"
print(s)

Fixed submission:
s=str(input())
s=s.replace("2017","2018")
print(s)

Buggy python submission (verdict: Runtime Error):
s=str(input())
s[3]="8
print(s)

Fixed submission:
s=str(input())
s=s.replace("2017","2018")
print(s)
Buggy python submission (verdict: Runtime Error):
a,b=map(str().input())
if a>b:
  print(">")
elif a==b:
  print("=")
else:
  print("<")

Fixed submission:
a,b=map(str,input().split())
if a>b:
  print(">")
elif a==b:
  print("=")
else:
  print("<")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
count =1 #ボタンを押した回数用 
s=0 #スタートするボタン　これを操作ボタンにしていく
while True:
    if a[s]==2:
        print(count)
        sys.exit()
    elif count>1 and s==0:
        print(-1)
        sys.exit()
    else:
        count+=1
        s=a[s]-1



Fixed submission:
import sys
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
count =1 #ボタンを押した回数用 
s=0 #スタートするボタン　これを操作ボタンにしていく
while True:
    if a[s]==2:
        print(count)
        sys.exit()
    elif count>n:
        print(-1)
        sys.exit()
    else:
        count+=1
        s=a[s]-1
Buggy python submission (verdict: Runtime Error):
s=input(s)
S=list(s)
b = len(S)
a =len(set(S))
if a==b: print("yes")
else: print("no")

Fixed submission:
s=input()
S=set(s)
if len(s)==len(S): 
    print("yes")
else: 
    print("no")
Buggy python submission (verdict: Runtime Error):
W,a,b = map(int,input().split())
if b> a+W:
    print(b-a-W)
elif a>b+w:
    print(a-b-W)
else:
    print(0)

Fixed submission:
W,a,b = map(int,input().split())
if a>b:
    a,b=b,a
if b>a+W:
    print(b-(a+W))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
S = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s: S+=1
print(S)

Fixed submission:
k,s=map(int,input().split())
print(sum(0<=s-y-z<=k for z in range(k+1) for y in range(k+1)))
Buggy python submission (verdict: Runtime Error):
#Bとその前１文字を消せば良い
s =list(input())
lis = []
for i in range(len(s)):
    if s[i] == "B":
        if len(lis)>1:
            lis[i-1]=""
            lis.append("")
    else: lis.append(s[i])
print("".join(lis))

Fixed submission:
#Bとその前１文字を消せば良い
s =list(input())
lis = []
for i in range(len(s)):
    if s[i] == "B":
        if len(lis) >0:
            lis.pop()
    else: lis.append(s[i])
print("".join(lis))

Buggy python submission (verdict: Runtime Error):
#Bとその前１文字を消せば良い
s =list(input())
lis = []
for i in range(len(s)):
    if s[i] == "B": 
        lis[i-1]=""
        lis.append("")
    else: lis.append(s[i])
print("".join(lis))

Fixed submission:
#Bとその前１文字を消せば良い
s =list(input())
lis = []
for i in range(len(s)):
    if s[i] == "B":
        if len(lis) >0:
            lis.pop()
    else: lis.append(s[i])
print("".join(lis))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split(' '))
cnt += 0
avi = 1
while 1:
    cnt += 1
    avi += a - 1
    if avi >= b:
        break
print(cnt)


Fixed submission:
a, b = map(int, input().split(' '))
cnt = 0
avi = 1
while 1:
    if avi >= b:
        break

    cnt += 1
    avi += a - 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ks = [[0] for i in range(m)]
jud = []
for i in range(m):
    tmp = list([int(i)-1 for i in input().split()])
    ks[i] = tmp[1:]
jud = list(map(int, input().split()))

ans = 0
c = True
for i in range(2 ** n):
    tmp = list()
    c = True
    for j in range(m):
        t = ks[j]
        ch = 0
        for m in t:
            ib = format(i, 'b')
            if len(ib) >= m+1:
                ch += int(ib[m])
            else:
                break
        if ch % 2 != jud[j]:
            c = False
            break
    if c:
        ans += 1
print(ans)


Fixed submission:
n, m = map(int, input().split())
ks = [[0] for i in range(m)]
jud = []
for i in range(m):
    tmp = list([int(i)-1 for i in input().split()])
    ks[i] = tmp[1:]
jud = list(map(int, input().split()))

ans = 0
c = True
for i in range(2 ** n):
    c = True
    ib = format(i, 'b')
    for iks, j in enumerate(ks):
        ch = 0
        for m in j:
            if len(ib) >= m+1:
                ch += int(ib[-m-1])
        if ch % 2 != jud[iks]:
            c = False
            break
    if c:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ks = [[0] for i in range(m)]
jud = []
for i in range(m):
    tmp = list([int(i)-1 for i in input().split()])
    ks[i] = tmp[1:]
jud = list(map(int, input().split()))

ans = 0
c = True
for i in range(2 ** n):
    tmp = list()
    c = True
    for j in range(m):
        t = ks[j]
        ch = 0
        for m in t:
            ch += tmp[m]
        if ch % 2 != jud[j]:
            c = False
            break
    if c:
        ans += 1
print(ans)


Fixed submission:
n, m = map(int, input().split())
ks = [[0] for i in range(m)]
jud = []
for i in range(m):
    tmp = list([int(i)-1 for i in input().split()])
    ks[i] = tmp[1:]
jud = list(map(int, input().split()))

ans = 0
c = True
for i in range(2 ** n):
    c = True
    ib = format(i, 'b')
    for iks, j in enumerate(ks):
        ch = 0
        for m in j:
            if len(ib) >= m+1:
                ch += int(ib[-m-1])
        if ch % 2 != jud[iks]:
            c = False
            break
    if c:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

l, r = map(int, input().split())
ans = set(range(l, r+1))
for i in range(m-1):
    l, r = map(int, input().split())
    ans = ans & set(range(l, r + 1))
print(len(ans))


Fixed submission:
n, m = map(int, input().split())

l, r = 0, 10 ** 6
for i in range(m):
    tl, tr = map(int, input().split())
    l = max(tl, l)
    r = min(tr, r)
print(len(range(l, r+1)))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

l, r = map(int, input().split())
ans = set(range(l, r+1))
for i in range(m-1):
    l, r = map(int, input().split())
    ans = ans & set(range(l, r + 1))
print(len(ans))


Fixed submission:
n, m = map(int, input().split())

l, r = 0, 10 ** 6
for i in range(m):
    tl, tr = map(int, input().split())
    l = max(tl, l)
    r = min(tr, r)
print(len(range(l, r+1)))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
mat = []
for _ in range(m):
    b, c = map(int, input().split())
    mat.extend([c] * b)
mat = sorted(mat, reverse=True)[:n]
for i, t in enumerate(a):
    if i == len(mat):
        break
    if t < mat[i]:
        a[i] = mat[i]
    else:
        break

print(sum(a))


Fixed submission:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
bc = [[0] * 2 for _ in range(m)]
for i in range(m):
    bc[i] = list(map(int, input().split()))
bc = sorted(bc, key=lambda x: x[1], reverse=True)
mat = []
for b, c in bc:
    if len(mat) + b > n:
        mat.extend([c] * (n - len(mat)))
        break
    else:
        mat.extend([c]*b)

for i, t in enumerate(a):
    if i == len(mat):
        break
    if t < mat[i]:
        a[i] = mat[i]
    else:
        break

print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
mat = []
for _ in range(m):
    b, c = map(int, input().split())
    mat.extend([c] * b)
mat = sorted(mat, reverse=True)[:n]
for i, t in enumerate(a):
    if i == len(mat):
        break
    if t < mat[i]:
        a[i] = mat[i]
    else:
        break

print(sum(a))


Fixed submission:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
bc = [[0] * 2 for _ in range(m)]
for i in range(m):
    bc[i] = list(map(int, input().split()))
bc = sorted(bc, key=lambda x: x[1], reverse=True)
mat = []
for b, c in bc:
    if len(mat) + b > n:
        mat.extend([c] * (n - len(mat)))
        break
    else:
        mat.extend([c]*b)

for i, t in enumerate(a):
    if i == len(mat):
        break
    if t < mat[i]:
        a[i] = mat[i]
    else:
        break

print(sum(a))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
mat = []
for _ in range(m):
    b, c = map(int, input().split())
    mat.extend([c] * b)
mat = sorted(mat, reverse=True)[:n]
for i, t in enumerate(a):
    if t < mat[i]:
        a[i] = mat[i]
    else:
        break

print(sum(a))


Fixed submission:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
bc = [[0] * 2 for _ in range(m)]
for i in range(m):
    bc[i] = list(map(int, input().split()))
bc = sorted(bc, key=lambda x: x[1], reverse=True)
mat = []
for b, c in bc:
    if len(mat) + b > n:
        mat.extend([c] * (n - len(mat)))
        break
    else:
        mat.extend([c]*b)

for i, t in enumerate(a):
    if i == len(mat):
        break
    if t < mat[i]:
        a[i] = mat[i]
    else:
        break

print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
q = deque(maxlen=n-1)

for i in range(n - 1):
    a, b, c = map(int, input().split())
    q.append([a-1, b-1, c % 2])

cllist = [-1] * n
a, b, c = q.popleft()
cllist[a] = 0
cllist[b] = c
while q:
    a, b, c = q.popleft()
    if cllist[a] != -1:
        cllist[b] = (cllist[a] + c) % 2
    elif cllist[b] != -1:
        cllist[a] = (cllist[b] + c) % 2
    else:
        q.append([a, b, c])
print(*cllist)


Fixed submission:
from collections import deque
n = int(input())
q = deque(maxlen=n-1)

for i in range(n - 1):
    a, b, c = map(int, input().split())
    q.append([a-1, b-1, c % 2])

cllist = [-1] * n
a, b, c = q.popleft()
cllist[a] = 0
cllist[b] = c
while q:
    a, b, c = q.popleft()
    if cllist[a] != -1:
        cllist[b] = (cllist[a] + c) % 2
    elif cllist[b] != -1:
        cllist[a] = (cllist[b] + c) % 2
    else:
        q.append([a, b, c])
print(*cllist)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
q = deque(maxlen=n-1)

for i in range(n - 1):
    a, b, c = map(int, input().split())
    q.append([a-1, b-1, c])

cllist = [-1] * n
a, b, c = q.popleft()
cllist[a] = 0
cllist[b] = c % 2
while q:
    a, b, c = q.popleft()
    if cllist[a] != -1:
        cllist[b] = (cllist[a] + c) % 2
    elif cllist[b] != -1:
        cllist[a] = (cllist[b] + c) % 2
    else:
        q.append([a, b, c])
for i in cllist:
    print(i)


Fixed submission:
from collections import deque
n = int(input())
q = deque(maxlen=n-1)

for i in range(n - 1):
    a, b, c = map(int, input().split())
    q.append([a-1, b-1, c % 2])

cllist = [-1] * n
a, b, c = q.popleft()
cllist[a] = 0
cllist[b] = c
while q:
    a, b, c = q.popleft()
    if cllist[a] != -1:
        cllist[b] = (cllist[a] + c) % 2
    elif cllist[b] != -1:
        cllist[a] = (cllist[b] + c) % 2
    else:
        q.append([a, b, c])
print(*cllist)

Buggy python submission (verdict: Time Limit Exceeded):
import collections as c
n = int(input())
q = c.deque()

for i in range(n - 1):
    a, b, c = map(int, input().split())
    q.append([a-1, b-1, c])

cllist = [-1] * n
a, b, c = q.popleft()
cllist[a] = 0
cllist[b] = c % 2
s = {a, b}
while q:
    a, b, c = q.popleft()
    if a in s:
        cllist[b] = (cllist[a] + (c % 2)) % 2
        s.add(b)
    elif b in s:
        cllist[a] = (cllist[b] + (c % 2)) % 2
        s.add(a)
    else:
        q.append([a, b, c])
for i in cllist:
    print(i)


Fixed submission:
from collections import deque
n = int(input())
q = deque(maxlen=n-1)

for i in range(n - 1):
    a, b, c = map(int, input().split())
    q.append([a-1, b-1, c % 2])

cllist = [-1] * n
a, b, c = q.popleft()
cllist[a] = 0
cllist[b] = c
while q:
    a, b, c = q.popleft()
    if cllist[a] != -1:
        cllist[b] = (cllist[a] + c) % 2
    elif cllist[b] != -1:
        cllist[a] = (cllist[b] + c) % 2
    else:
        q.append([a, b, c])
print(*cllist)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
v = [int(i) for i in input().split()]
if n == 2:
    print(max(v))


def gcd(x, y):
    if y > x:
        x, y = y, x
    if y == 0:
        return x
    if x % y == 0:
        return y
    return gcd(y, x % y)


l = [0 for i in range(n)]
Y = [0 for i in range(n)]

for i in range(1, n):
    l[i] = gcd(l[i - 1], v[i - 1])
for i in range(n - 1)[::-1]:
    r[i] = gcd(r[i+1], v[i+1])
m = [gcd(l[i], r[i]) for i in range(n)]
print(max(m))


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


def gcd(x, y):
    if y > x:
        x, y = y, x
    if y == 0:
        return x
    if x % y == 0:
        return y
    return gcd(y, x % y)


l = [0 for i in range(n)]
r = [0 for i in range(n)]

for i in range(1, n):
    l[i] = gcd(l[i - 1], v[i - 1])
for i in range(n - 1)[::-1]:
    r[i] = gcd(r[i+1], v[i+1])
m = [gcd(l[i], r[i]) for i in range(n)]
print(max(m))

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
v = [int(i) for i in input().split()]
if n == 2:
    print(max(v))

l = [0 for i in range(n)]
r = l[:]


def gcd(x, y):
    if y > x:
        x, y = y, x
    if y == 0:
        return x
    if x % y == 0:
        return y
    return gcd(y, x % y)


for i in range(n):
    l[i+1] = gcd(l[i], v[i])
    r[-i] = gcd(r[-i-1], v[-i-1])
m = [gcd(l[i], r[i]) for i in range(n)]
print(max(m))


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


def gcd(x, y):
    if y > x:
        x, y = y, x
    if y == 0:
        return x
    if x % y == 0:
        return y
    return gcd(y, x % y)


l = [0 for i in range(n)]
r = [0 for i in range(n)]

for i in range(1, n):
    l[i] = gcd(l[i - 1], v[i - 1])
for i in range(n - 1)[::-1]:
    r[i] = gcd(r[i+1], v[i+1])
m = [gcd(l[i], r[i]) for i in range(n)]
print(max(m))
Buggy python submission (verdict: Runtime Error):
import sys
import math

mat = list(sys.stdin.readline())

odd = 0
even = 0
l = len(mat)
for i, x in enumerate(mat):
    if int(x) == 1:
        if i % 2 == 0:
            even += 1
        else:
            odd += 1

if odd > even:
    print(even + math.ceil(l / 2) - odd)
else:
    print(odd + math.floor(l/2) - even)


Fixed submission:
import sys
import math

mat = list(sys.stdin.readline().strip())

odd = 0
even = 0
for i, x in enumerate(mat):
    flg = i % 2
    if flg:
        if int(x) == 1:
            even += 1
        else:
            odd += 1
    else:
        if int(x) == 1:
            odd += 1
        else:
            even += 1

print(min(odd, even))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

a, b = map(int, sys.stdin.readline().split())

ans = a
for i in range(b - a):
    ans = ans ^ (a + i + 1)
print(ans)


Fixed submission:
import sys

a, b = map(int, sys.stdin.readline().split())


def check(x):
    if x % 4 == 0:
        return x
    elif x % 2 == 0:
        return x + 1
    elif (x+1)/2 % 2 == 0:
        return 0
    else:
        return 1


a = check(a-1)
b = check(b)
print(a ^ b)
Buggy python submission (verdict: Runtime Error):
import sys
s = list(sys.stdin.readline())
l = len(s)
cnt = 0
ans = 0
while cnt < l-1:
    if int(s[cnt]) + int(s[cnt + 1]) == 1:
        del s[cnt:cnt + 2]
        cnt = 0
        ans += 2
        l = len(s)
    else:
        cnt += 1
print(ans)


Fixed submission:
import sys
s = list(sys.stdin.readline())
l = len(s)
cnt0, cnt1 = 0, 0
for i in s:
    if "0" in i:
        cnt0 += 1
    elif "1" in i:
        cnt1 += 1

print(min(cnt0, cnt1)*2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

n=int(sys.stdin.readline())
a,b,M = [0]*n,[0]*n,[]
for i in range(n):
    a[i],b[i] = map(int,sys.stdin.readline().split())
    M.append(a[i]+b[i])

cnt = 0
tflg = True
for i in range(n):
    mat = min(M)
    id = M.index(mat)
    if tflg:
        cnt += a[id]
    else:
        cnt -= b[id]
    tflg = not(tflg)
    M.pop(id)
    a.pop(id)
    b.pop(id)
print(cnt)


Fixed submission:
import sys

n=int(sys.stdin.readline())
M = []
for i in range(n):
    a,b = map(int,sys.stdin.readline().split())
    M.append([a,b])

M = sorted(M,key=lambda x:sum(x), reverse=True)
cnt = 0
for i in range(n):
    if i%2==0:
        cnt += M[i][0]
    else:
        cnt -= M[i][1]
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
n,p=map(int,input().split())
if p==1:
    print(1)
    exit()
if n==1:
    print(p)
    exit()
i = 2
cnt,ans=0,1
while i<=p:
    if p % i == 0:
        cnt+=1
        p/=i
    else:
        if cnt>=n:
            ans*=i*math.floor(cnt/n)
        cnt=0
        if i==2:
            i+=1
        else:
            i+=2
if cnt>=n:
    ans*=i*math.floor(cnt/n)
print(ans)

Fixed submission:
n=int(input())
cnt=0
while n >= 1:
    if n%10==2:
        cnt+=1
    n=int(n/10)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):

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

M = 0
ans_lst = [0] * N

for i in range(N-1, -1, -1):
    if sum(ans_lst[i::i+1]) % 2 != a_lst[i]:
        ans_lst[i] = 1
    

m = sum(ans_lst)    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)




Fixed submission:

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

M = 0
ans_lst = [0] * N

for i in range(N-1, -1, -1):
    if sum(ans_lst[i::i+1]) % 2 != a_lst[i]:
        ans_lst[i] = 1
    

m = sum(ans_lst)    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)

Buggy python submission (verdict: Time Limit Exceeded):

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

M = 0
ans_lst = [0] * N

t = 0
for i in range(N-1, -1, -1):
    t = sum(ans_lst[i::i+1])
        
    if t % 2 != a_lst[i]:
        ans_lst[i] = 1
    


m = 0
for i in range(N):
    m += ans_lst[i]
    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)




Fixed submission:

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

M = 0
ans_lst = [0] * N

for i in range(N-1, -1, -1):
    if sum(ans_lst[i::i+1]) % 2 != a_lst[i]:
        ans_lst[i] = 1
    

m = sum(ans_lst)    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)

Buggy python submission (verdict: Runtime Error):

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

M = 0
ans_lst = [0] * N

t = 0
for i in range(N-1, -1, -1):
    t = sum(ans[i::i+1])
        
    if t % 2 != a_lst[i]:
        ans_lst[i] = 1
    


m = 0
for i in range(N):
    m += ans_lst[i]
    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)




Fixed submission:

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

M = 0
ans_lst = [0] * N

for i in range(N-1, -1, -1):
    if sum(ans_lst[i::i+1]) % 2 != a_lst[i]:
        ans_lst[i] = 1
    

m = sum(ans_lst)    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)

Buggy python submission (verdict: Runtime Error):

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

M = 0
ans_lst = [0] * N

t = 0
for i in range(N, -1, -1):
    t = 0
    for j in range(2*i, N, i+1):
        t += ans_lst[j]
        
    if (t + 1) % 2 == a_lst[i]:
        ans_lst[i] = 1
    


m = 0
for i in range(N):
    m += ans_lst[i]
    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        if i != 0:
            ans_str += " "
        ans_str += str(i+1)
print(ans_str)




Fixed submission:

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

M = 0
ans_lst = [0] * N

for i in range(N-1, -1, -1):
    if sum(ans_lst[i::i+1]) % 2 != a_lst[i]:
        ans_lst[i] = 1
    

m = sum(ans_lst)    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)