TnT/CodeNet4Repair huggingface dataset:
Problem:
宇宙暦 1603〜1867 年，人々はその時代のことを EDO 時代と呼ぶ．EDO とは当時最先端の宇宙航行技術，Enhanced Driving Operation のことであり、1603 年に Dr.Izy によって開発された．  あなたは宇宙冒険家であり，宇宙を飛び回って様々な惑星を冒険していた．その冒険の途中で，あなたはとても不思議な惑星を発見した．その惑星には，至るところに七色に輝く不思議な宝石が落ちていた．あなたはその惑星への降下を試みようと考えたが，重大な問題のためにそれは不可能であることがわかった．その惑星の空気には，人間が触れただけで即死してしまうような猛毒の成分が含まれていたのだ．  そこで，あなたはロボットを使って宝石を回収することを考えついた．あなたはその惑星の周回軌道にて待機する．そして，降下させたロボットを遠隔操作することによって宝石を回収するのだ．あなたは，ロボットに「移動する方向」と「移動する距離」の組からなる命令の列によってロボットを遠隔操作する．ロボットは移動経路上（到達点を含む）に宝石を見つけると，それらを全て回収する．  あなたの仕事は，ロボットが与えられた全ての命令の実行を終えたときに，全ての宝石を回収することができたかどうかを判定するプログラムを書くことである．  なお，ロボットが不思議な宝石を回収する範囲はそれほど広くない．そのため，ロボットが移動する範囲は全て 2 次元の平面で表すことができる．そして，ロボットが移動する範囲は (0,0) および (20,20) をそれぞれ左下隅および右上隅とする正方形の内部（境界線を含む）である．ロボットは常に範囲の中央，すなわち (10,10) の座標に降下する．また，全ての宝石は中央以外の格子点上にあることが保証されている．

Incorrect submission (verdict: Wrong Answer):
#!/usr/bin/python3

while True:
    n = int(input())
    if n == 0 : break

    gems = []
    for i in range(n):
        gem = tuple(map(int, input().split()))
        gems.append(gem)
    
    m = int(input())
    bot = [10, 10]
    history = [(10, 10)]
    for j in range(m):
        move = list(input().split())
        move[1] = int(move[1])
        if move[0] == 'N':
            index = 1 #y
            direc = 1 # pos
        elif move[0] == 'S':
            index = 1
            derec = -1 
        elif move[0] == 'E':
            index = 0 #x
            direc = 1
        else: #W
            index = 0
            direc = -1
        for j in range(abs(move[1])):
            bot[index] += direc
            history.append(tuple(bot))
    for g in gems:
        if g not in history:
            print("No")
            break
    print("Yes")

Fixed, accepted submission:
#!/usr/bin/python3

while True:
    n = int(input())
    if n == 0 : break

    gems = []
    for i in range(n):
        gem = tuple(map(int, input().split()))
        gems.append(gem)
    
    m = int(input())
    bot = [10, 10]
    history = [(10, 10)]
    for j in range(m):
        move = list(input().split())
        move[1] = int(move[1])
        if move[0] == 'N':
            index = 1 #y
            direc = 1 # pos
        elif move[0] == 'S':
            index = 1
            direc = -1 
        elif move[0] == 'E':
            index = 0 #x
            direc = 1
        else: #W
            index = 0
            direc = -1
        for j in range(abs(move[1])):
            bot[index] += direc
            history.append(tuple(bot))
    f = True
    for g in gems:
        if g not in history:
            f = False
            break
    print("Yes" if f else "No")
Problem:
You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}.  Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1.

Incorrect submission (verdict: Wrong Answer):
size=[int(i) for i in input().split()]
image=[[str(input())] for i in range(size[0])]

print(image)
print("#"*(size[1]+2))
for i in image:
    print(''.join(["#"]+i+["#"]))
print("#"*(size[1]+2))

Fixed, accepted submission:
size=[int(i) for i in input().split()]
image=[[str(input())] for i in range(size[0])]

print("#"*(size[1]+2))
for i in image:
    print(''.join(["#"]+i+["#"]))
print("#"*(size[1]+2))
Problem:
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.  The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)  Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?

Incorrect submission (verdict: Wrong Answer):
X = int(input())
import math
price=100
year=0
while True:
  price += round(price*0.01)
  year+=1
  print(price)
  if price >= X:
    break
print(year)

Fixed, accepted submission:
import math
X = int(input())
price=100
year=0
while price < X:
  price += math.floor(price*0.01)
  year+=1
print(year)
Problem:
Snuke loves working out. He is now exercising N times.  Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i.  Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.

Incorrect submission (verdict: Wrong Answer):
import math
N = int(input())
a = math.factorial(N)
print(a)
x = a % (10**9+7)
print(x)


Fixed, accepted submission:
import math
N = int(input())
a = math.factorial(N)
x = a % (10**9+7)
print(x)
Problem:
Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer.

Incorrect submission (verdict: Wrong Answer):
n=int(input())

ans=0

while ans*ans<=n:
    ans+=1
print(ans-1)

Fixed, accepted submission:
n=int(input())

ans=0

while ans*ans<=n:
    ans+=1
print((ans-1)**2)
Problem:
We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.  However, she cannot enter the cells in the intersection of the bottom A rows and the leftmost B columns. (That is, there are A×B forbidden cells.) There is no restriction on entering the other cells.  Find the number of ways she can travel to the bottom-right cell.  Since this number can be extremely large, print the number modulo 10^9+7.

Incorrect submission (verdict: Wrong Answer):
MOD = 10**9+7
N = 200000
p = [1] * (N+1)
q = [1] * (N+1)
for i in range(1, N+1):
    p[i] = (p[i-1]*(i)%MOD)
q[0] = pow(p[-1], MOD-2, MOD)
for i in range(1, N+1):
    q[i] = (N-i+1)*q[i-1]%MOD
q.reverse()

def nCk(n,k):
    if k > n or n == 0:
        return 0
    elif k == 0:
        return 1
    else:
        return p[n]*q[k]%MOD*q[n-k]%MOD

h,w,a,b = map(int, input().split())

ans = 0
for i in range(b, w):
    ans += nCk(h-a+i-1, i)*nCk(w-i-2+a, w-i-1)%MOD
print(ans%MOD)


Fixed, accepted submission:
MOD = 10**9+7
N = 200000
p = [1] * (N+1)
q = [1] * (N+1)
for i in range(1, N+1):
    p[i] = (p[i-1]*(i)%MOD)
q[0] = pow(p[-1], MOD-2, MOD)
for i in range(1, N+1):
    q[i] = (N-i+1)*q[i-1]%MOD
q.reverse()

def nCk(n,k):
    if k > n or (k != 0 and n == 0):
        return 0
    elif k == 0:
        return 1
    else:
        return p[n]*q[k]%MOD*q[n-k]%MOD

h,w,a,b = map(int, input().split())

ans = 0
for i in range(b, w):
    ans += nCk(h-a+i-1, i)*nCk(w-i-2+a, w-i-1)%MOD
print(ans%MOD)
Problem:
Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b.  Determine whether the arrangement of the poles is beautiful.

Incorrect submission (verdict: Wrong Answer):
A,B,C=map(int,input().split())
if B-A==C-A:
  print('YES')
else:
  print('NO')

Fixed, accepted submission:
A,B,C=map(int,input().split())
if B-A==C-B:
  print('YES')
else:
  print('NO')
Problem:
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up.   Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1.   Here, both the x\- and y-coordinates before and after each movement must be integers.   He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy).   Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty).   Under this condition, find a shortest path for him.

Incorrect submission (verdict: Wrong Answer):
def main():
    sx, sy, tx, ty = map(int, input().split())
    ans = solve(sx, sy, tx, ty)
    print(ans)


def solve(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    st = 'U' * dy + 'R' * dx
    ts = 'D' * dy + 'L' * dy
    rt1 = st + ts
    rt2 = 'L' + 'U' + st + 'R' + 'D' + 'R' + 'D' + ts + 'L' + 'U'
    ans = rt1 + rt2
    return ans


if __name__ == '__main__':
    main()

Fixed, accepted submission:
def main():
    sx, sy, tx, ty = map(int, input().split())
    ans = solve(sx, sy, tx, ty)
    print(ans)


def solve(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    st = 'U' * dy + 'R' * dx
    ts = 'D' * dy + 'L' * dx
    rt1 = st + ts
    rt2 = 'L' + 'U' + st + 'R' + 'D' + 'R' + 'D' + ts + 'L' + 'U'
    ans = rt1 + rt2
    return ans


if __name__ == '__main__':
    main()
Problem:
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up.   Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1.   Here, both the x\- and y-coordinates before and after each movement must be integers.   He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy).   Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty).   Under this condition, find a shortest path for him.

Incorrect submission (verdict: Wrong Answer):
sx, sy, tx, ty = map(int, input().split())

x = tx-sx
y = ty-sy
ans = ""
out1 = "R"*x+"U"*y
return1 = "L"*x+"D"*y
out2a = "LU"
out2b = "RD"
return2a = "RD"
return2b = "LU"
print(out1+return1+out2a+out1+out2b+return2a+return1+return2b)


Fixed, accepted submission:
sx, sy, tx, ty = map(int, input().split())
x = tx-sx
y = ty-sy

ans = ""
go = "U"*y+"R"*x
back = "D"*y+"L"*x
a1 = "LU"
a2 = "RDRD"
a3 = "LU"
print(go+back+a1+go+a2+back+a3)
Problem:
You are given a string S.  Takahashi can insert the character `A` at any position in this string any number of times.  Can he change S into `AKIHABARA`?

Incorrect submission (verdict: Wrong Answer):
S = list(input())
n = len(S)
def solve(S):
    if n < 5 or n > 9:
        return "No"
    while len(S) < 9:
        if S[0] != "A":
            S.insert(0, "A")
        elif S[4] != "A":
            S.insert(4, "A")
        elif S[6] != "A":
            S.insert(6, "A")
        elif S[-1] != "A":
            S.append("A")
    if "".join(S) == "AKIHABARA":
        return "Yes"
    else:
        return "No"
print(solve(S))

Fixed, accepted submission:
 
import re
 
 
S = input()
 
if re.fullmatch(r"A?KIHA?BA?RA?",S):
    print("YES")
else:
    print("NO")
exit()
Problem:
Takahashi is organizing a party.  At the party, each guest will receive one or more snack pieces.  Takahashi predicts that the number of guests at this party will be A or B.  Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.  We assume that a piece cannot be divided and distributed to multiple guests.

Incorrect submission (verdict: Wrong Answer):
def gcd(a, b):
    if a < b :
        a, b = b, a
    while True:
        a, b = b, a % b
        if b == 0:
            return a

a, b = map(int, input().split())
int(a * b / gcd(a, b))

Fixed, accepted submission:
def gcd(a, b):
    if a < b :
        a, b = b, a
    while True:
        a, b = b, a % b
        if b == 0:
            return a

a, b = map(int, input().split())
print(int(a * b / gcd(a, b)))
Problem:
Snuke built an online judge to hold a programming contest.  When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)  Determine whether the judge can return the string `AC` as the verdict to a program.

Incorrect submission (verdict: Wrong Answer):
S = input()
for i in range(len(S)-1):
  if S[i]+S[i] == "AC":
    print("Yes")
    break
print("No")

Fixed, accepted submission:
import sys
S = input()
for i in range(len(S)-1):
  if S[i]+S[i+1] == "AC":
    print("Yes")
    sys.exit()
print("No")
Problem:
AtCoDeer has three cards, one red, one green and one blue.   An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.   We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer.   Is this integer a multiple of 4?

Incorrect submission (verdict: Wrong Answer):
a = input().strip()
print(a)

Fixed, accepted submission:
a = input().strip().split()
num = int(''.join(a))
if num%4==0:
  print('YES')
else:
  print('NO')
Problem:
You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order.

Incorrect submission (verdict: Wrong Answer):
s = list(input())
t = list(input())

s_a = ''.join(sorted(s))
t_a = ''.join(sorted(t))

if s_a < t_a :
    print('Yes')
else :
    print('No')


Fixed, accepted submission:
s = list(input())
t = list(input())

s_a = ''.join(sorted(s))
t_a = ''.join(sorted(t, reverse=True))
if s_a < t_a :
    print('Yes')
else :
    print('No')
Problem:
Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.  The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).  Takahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.  If there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.

Incorrect submission (verdict: Wrong Answer):
n = int(input())

x = round(n / 1.08)
n_dash = int(x*1.08)
if n_dash == n:
    print(n_dash)
elif n_dash-1 == n:
    print(n_dash-1)
elif n_dash+1 == n:
    print(n_dash+1)
else:
    print(':(')

Fixed, accepted submission:
def n_cand(x):
    return int(x*1.08)

n = int(input())

x = round(n / 1.08)
n_dash = n_cand(x)
n_dash_m = n_cand(x-1)
n_dash_p = n_cand(x+1)
if n_dash == n:
    print(x)
elif n_dash_m == n:
    print(x-1)
elif n_dash_p == n:
    print(x+1)
else:
    print(':(')
Problem:
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.  Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem.

Incorrect submission (verdict: Wrong Answer):
i=0
a=list()
while True :
    a.append(int(input()))
    i+=1
    if a[i-1]==0:
        break
for j in range(i) :
    print("Case" , j+1 ,":",a[j])


Fixed, accepted submission:
i=0
a=list()
while True :
    a=int(input())

    if a == 0:
        break

    i+=1
    print('Case %d: %d'%(i,a))
Problem:
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.

Incorrect submission (verdict: Wrong Answer):
a,b = map(str, input().split())

abint = int(a+b)

ans = 0

for i in range(1,1001):
    for j in range(1,1001):
        if i*j == abint and i == j:
            ans = ans + 1

if ans == 0:
    print("No")
else:
    print("Yes")


Fixed, accepted submission:
a,b = map(int, input().split())

a_b = ((a*b)%2)

if a_b == 0:
    print("Even")
else:
    print("Odd")
Problem:
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.  Determine if it is possible that there are exactly X cats among these A + B animals.

Incorrect submission (verdict: Wrong Answer):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b,x = map(int,input().split())
ab = a+b
least = x - a
if least<0:
    print("No")
    sys.exit()
if b>=least:
    print("Yes")
else:
    print("No")


Fixed, accepted submission:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b,x = map(int,input().split())
ab = a+b
if x>=a and x<=ab:
    print("YES")
else:
    print("NO")
Problem:
There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.

Incorrect submission (verdict: Wrong Answer):
def main():
    N = int(input())
    a = [None] + list(map(int, input().split()))
    b = [0]*(N+1)
    for i in range(N, 0, -1):
        ball = [b[j] for j in range(i, N+1, i)]
        if sum(ball) % 2 != a[i]:
            b[i] = 1
    print(' '.join(map(str, b[1:])))
main()

Fixed, accepted submission:
def main():
    N = int(input())
    a = [None] + list(map(int, input().split()))
    b = [None] + [0]*N
    for i in range(N, 0, -1):
        ball = [b[j] for j in range(i, N+1, i)]
        if sum(ball) % 2 != a[i]:
            b[i] = 1
    ans = [str(i) for i, n in enumerate(b) if n==1]
    print(len(ans))
    print(' '.join(map(str, ans)))
main()
Problem:
You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)] 

A = sorted(A)
print(A)
res = 0
if len(A) % 2 == 1:
    if len(A) > 3:
        mid = int(len(A)/2)
        now_num = A.pop(mid)
        for i in range(len(A)):
            if len(A) == 0:
                break
            if i % 2 == 0:
                res += A[-1] - now_num
                now_num = A.pop(-1)
            else:
                res += now_num - A[0]
                now_num = A.pop(0)
        print(res)
    else:
        res += A[-1] - A[0]
        res += A[-2] - A[0]
        print(res)
else:
    mid = int(len(A)/2) - 1
    now_num = A.pop(mid)
    for i in range(len(A)):
        if len(A) == 0:
            break
        if i % 2 == 0:
            res += A[-1] - now_num
            now_num = A.pop(-1)
        else:
            res += now_num - A[0]
            now_num = A.pop(0)
    print(res)

Fixed, accepted submission:
N = int(input())
A_in = [int(input()) for _ in range(N)] 
 
A = sorted(A_in)
res1 = 0
A2 = []
for i in range(len(A)):
    if len(A) == 1:
        if abs(A[0] - A2[0]) < abs(A[0] - A2[-1]):
            A2.append(A[0])
        else:
            A2.insert(0,A[0])
        break
    if i % 2 == 0:
        A2.append(A.pop(-1))
    else:
        A2.append(A.pop(0))
for i in range(len(A2)-1):
    res1 += abs(A2[i] - A2[i+1])

A = sorted(A_in,reverse=True)
res2 = 0
A2 = []
for i in range(len(A)):
    if len(A) == 1:
        if abs(A[0] - A2[0]) < abs(A[0] - A2[-1]):
            A2.append(A[0])
        else:
            A2.insert(0,A[0])
        break
    if i % 2 == 0:
        A2.append(A.pop(-1))
    else:
        A2.append(A.pop(0))
for i in range(len(A2)-1):
    res2 += abs(A2[i] - A2[i+1])

print(max(res1,res2))
Problem:
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.    An example of a trapezoid  Find the area of this trapezoid.

Incorrect submission (verdict: Wrong Answer):
a = int(input())
b = int(input())
h = int(input())

print((a+b)/2*h)

Fixed, accepted submission:
a = int(input())
b = int(input())
h = int(input())

print(int((a+b)/2*h))
Problem:
Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.  Find the number of chocolate pieces prepared at the beginning of the camp.

Incorrect submission (verdict: Wrong Answer):
import math
n = int(input())
d,x = map(int,input().split())
cou = x
for i in range(n):
  cou += math.ceil(int(input())/d)
print(cou)

Fixed, accepted submission:
import math
n = int(input())
d,x = map(int,input().split())
lis = [int(input()) for i in range(n)]
cou = x
for i in range(n):cou += math.ceil(d/lis[i])
print(cou)
Problem:
Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately.  He has very high awareness of safety, and decides to buy two bells, one for each hand.  The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the minimum total price of two different bells.

Incorrect submission (verdict: Wrong Answer):
a,b,c=map(int,input().split())
if a>b and a>c:
    print(a+b)
elif b>a and b>c:
    print(a+c)
else:
    print(b+c)

Fixed, accepted submission:
a=list(map(int,input().split()))
b=sorted(a)
print(b[0]+b[1])
Problem:
There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
a = [-1]
a.extend([int(i) for i in input().split()])

ans = [-1]
ans.extend([0 for i in range(N)])

for i in reversed(range(1, N+1)):
    tmp = 0
    for j in reversed(range(i,N+1)):
        if j == i:
            if tmp % 2 == 0:
                ans[j] = 1
            else:
                ans[j] = 0
        if j % i == 0:
            tmp += ans[j]

print(len(ans)-1)
print(ans[1:])

Fixed, accepted submission:
N = int(input())
a = [int(i) for i in input().split()]

ans = [0 for i in range(N)]

for i in reversed(range(1, N+1)):
    tmp = 0
    for j in range(i, N+1, i):
        tmp += ans[j-1]
    if tmp % 2 != a[i-1]:
        ans[i-1] = 1

anslist = []
for i in range(N):
    if ans[i] == 1:
        anslist.append(i+1)

print(len(anslist))
print(*anslist)