Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math

n ,p = map(int, input().split())

p_part_list = {}


for i in range(2,int(p) +1):
  if p % i == 0:
    while (p % i == 0):
      if i not in p_part_list:
        p_part_list[i] = 1
        p = p // i
      else:
        p_part_list[i] += 1
        p = p // i
      
if p > 1:
  p_part_list[p] = 1
  
max_num = 1
#print(p_part_list)

for num in p_part_list:
  if p_part_list[num] >= n:	# N個の整数にその数を最低１個割り振れるかチェック
    if max_num < num * int(p_part_list[num]/n): #均等に割り振れれば、振り振る（１個以上可）
      max_num *= num * int(p_part_list[num]/n)
    
print(max_num)




Fixed submission:
import math

n ,p = map(int, input().split())

p_part_list = {}


for i in range(2,int(math.sqrt(p)) +1):
  if p % i == 0:
    while (p % i == 0):
      if i not in p_part_list:
        p_part_list[i] = 1
        p = p // i
      else:
        p_part_list[i] += 1
        p = p // i
      
if p > 1:
  p_part_list[p] = 1
  
max_num = 1
#print(p_part_list)

for num in p_part_list:
  if p_part_list[num] >= n:	# N個の整数にその数を最低１個割り振れるかチェック
   # if max_num < num ** int(p_part_list[num]/n): #均等に割り振れれば、振り振る（１個以上可）
    max_num *= num ** int(p_part_list[num]/n)
    
print(max_num)
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
    S = input()
    ans = 0
    bcount = 0
    for i in range(len(S)):
        if S[i] == 'B':
            bcount += 1
        else:
            ans += bcount
​
    print(ans)

Fixed submission:
S = list(input())

#print(S)

n = 1 if S[0] == "W" else 0# number of white string
count = 0
for i in range(1, len(S)):
    if S[i] == "W":
        count += i - n
        n += 1
        #print("n is", n)
        #print("count is ", count)
print(count)
Buggy python submission (verdict: Runtime Error):
n, T = map(int, input().split())

keep_cost = 1001

for i in range(n):
    c,t = map(int, input().split())
    if T >= t:
        if c <= keep_cost:
            keep_cost = c


print(keep_cost if keep_cos != 1001 else "TLE")

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

keep_cost = 1001
taken_t = 1001
for i in range(n):
    c,t = map(int, input().split())
    if T >= t:
        if c <= keep_cost:
            keep_cost = c
            taken_t = t

print(keep_cost if taken_t <= T else "TLE")
Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce

n, X = map(int, input().split())
x = list(map(int, input().split()))

x.append(X)
x = sorted(x)
diff_x = []
for i in range(len(x)-1):
    diff_x.append(x[i+ 1] - x[i])


ans = reduce(gcd, diff_x)

print(ans)




Fixed submission:
from fractions import gcd
from functools import reduce

n, X = map(int, input().split())
x = list(map(int, input().split()))

x.append(X)
x = sorted(x)
diff_x = []
for i in range(len(x)-1):
    diff_x.append(x[i+ 1] - x[i])


ans = reduce(gcd, diff_x)

print(ans)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from functools import reduce
N = int(input())
a = list(map(int, input().split()))

list_ans = []

for i in range(N):
    remove_a = a.pop(0)
    #print("a is",a)
    ans = reduce(gcd, a)
    list_ans.append(ans)
    a.append(remove_a)
    #print("fix a is",a)

print(max(list_ans))

Fixed submission:
n = int(input())

div_count = 0
sum = 0

for i in range(3,n+1,2):
    a = i
    j = 2
    div_count = 0
    while(j <= a):
        #print("a is",a)
        #print("j is",j)
        if a % j == 0:
            div_count += 1
            a //= j
            j += 1
        else:
            j += 1
    if div_count == 3:
        sum += 1

print(sum)
Buggy python submission (verdict: Runtime Error):
CONST_DIVSOR = 998244353
N = int(input())
Ds = list(map(int, input().strip().split()))
counter = [0]*N
for D in Ds:
    counter[D] += 1
total = 0
cnt = 0
prenumi = 0
for i in range(N):
    if i == 0:
        if counter[i] == 1:
            total = 1
            prenumi = 1
            cnt = 1
        else:
            break
    else:
        numi = counter[i]
        if numi != 0:
            case = 1
            for j in range(numi):
                case = (case * prenumi) % CONST_DIVSOR
            total = (total * case) % CONST_DIVSOR
            prenumi = numi
            cnt += numi
        else:
            total = 0
            break
    # print(i,total,prenumi,cnt)
    if cnt >= N:
        break

print(total % CONST_DIVSOR)


Fixed submission:
N = int(input())

print((N-1)//2)

Buggy python submission (verdict: Runtime Error):
CONST_DIVSOR = 998244353
N = int(input())
Ds = list(map(int, input().strip().split()))
counter = [0]*N
for D in Ds:
    counter[D] += 1
total = 0
cnt = 0
prenumi = 0
for i in range(N):
    if i == 0:
        if counter[i] == 1:
            total = 1
            prenumi = 1
            cnt = 1
        else:
            break
    else:
        numi = counter[i]
        if numi != 0:
            case = 1
            for j in range(numi):
                case = (case * prenumi) % CONST_DIVSOR
            total = (total * case) % CONST_DIVSOR
            prenumi = numi
            cnt += numi
        else:
            total = 0
            break
    # print(i,total,prenumi,cnt)
    if cnt >= N:
        break

print(total % CONST_DIVSOR)


Fixed submission:
N = int(input())

print((N-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
Xs = list(map(int,input().split()))
Xs.sort()
diffs = []
for i in range(1,M):
    diffs.append(Xs[i]-Xs[i-1])

if len(diffs) != 0:
    for i in range(N-1):
        diffs[diffs.index(max(diffs))] = 0

print(sum(diffs))

Fixed submission:
N,M = map(int,input().split())
Xs = list(map(int,input().split()))
Xs.sort()
diffs = []
for i in range(1,M):
    diffs.append(Xs[i]-Xs[i-1])
if len(diffs) > 0 and M > N:
    diffs.sort()
    print(sum(diffs[:M-N]))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
if a==0 and b==0:
    print(0)
else:
    a = a - k
    a2 = a
    if a<0:
        a=0
    b= b + a2
    if b<0:
        b=0
	print(a,b)


Fixed submission:
def solve(a,b,k):
    if a==0 and b==0:
        return '0 0'
    if a>=k:
        str = '%d %d' % (a-k,b)
        return str
    else:
        b = b + a - k
        a = 0
        if b<0:
            return '0 0'
        str = '0 %d' % (b)
        return str 
        

a,b,k = map(int, input().split())
print(solve(a,b,k))

Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
if a==0 and b==0:
    print(0)
else:
    a = a - k
    a2 = a
    if a<0:
        a=0
    b= b + a2
    if b<0:
        b=0
	print(a,b)



Fixed submission:
def solve(a,b,k):
    if a==0 and b==0:
        return '0 0'
    if a>=k:
        str = '%d %d' % (a-k,b)
        return str
    else:
        b = b + a - k
        a = 0
        if b<0:
            return '0 0'
        str = '0 %d' % (b)
        return str 
        

a,b,k = map(int, input().split())
print(solve(a,b,k))

Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
if a==0 and b==0:
    print(0)
else:
    a = a - k
    a2 = a
    if a<0:
        a=0
    b= b + a2
    if b<0:
        b=0
print(a,b)


1 3 1000
0 1

Fixed submission:
def solve(a,b,k):
    if a==0 and b==0:
        return '0 0'
    if a>=k:
        str = '%d %d' % (a-k,b)
        return str
    else:
        b = b + a - k
        a = 0
        if b<0:
            return '0 0'
        str = '0 %d' % (b)
        return str 
        

a,b,k = map(int, input().split())
print(solve(a,b,k))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int, input().split())

while k:
    if a>=1:
        a-=1
    elif b>=1:
        b-=1
    k-=1

print(a,b)

Fixed submission:
def solve(a,b,k):
    if a==0 and b==0:
        return '0 0'
    if a>=k:
        str = '%d %d' % (a-k,b)
        return str
    else:
        b = b + a - k
        a = 0
        if b<0:
            return '0 0'
        str = '0 %d' % (b)
        return str 
        

a,b,k = map(int, input().split())
print(solve(a,b,k))
Buggy python submission (verdict: Runtime Error):
n = int(input())
if 1=<n<=81:
    if n%10==0:
        print('Yes' if n==10 else 'No')
    else:
        print('Yes')

else:
    print('No')

Fixed submission:
l=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, 28, 30, 32, 35, 36, 40, 42, 45, 48, 49, 54, 56, 63, 64, 72, 81]
print('Yes' if int(input()) in l else 'No')
Buggy python submission (verdict: Runtime Error):
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

D1 = T1 * A1 - T1 * B1
D2 = T1 * A1 + T2 * A2 - T1 * B1 - T2 * B2

if D1 * D2 > 0:
    print(0)
elif D2 == 0:
    print("infinity")
else:
    c = 1
    D1 = abs(D2 - D1)
    D2 = abs(D2)
    Dp = D2
    while True:
        Dp += D2
        if Dp > D1:
            break
        elif Dp == D1:
            c += 1
            break
        c += 2
    print(c)

Fixed submission:
Ma, Da = map(int, input().split())
Mb, Db = map(int, input().split())
if (Ma == 12 and Mb == 1) or Mb > Ma:
    print("1")
else:
    print("0")
Buggy python submission (verdict: Time Limit Exceeded):
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

D1 = T1 * A1 - T1 * B1
D2 = T1 * A1 + T2 * A2 - T1 * B1 - T2 * B2

if D1 * D2 > 0:
    print(0)
elif D2 == 0:
    print("infinity")
else:
    c = 1
    D1 = abs(D2 - D1)
    D2 = abs(D2)
    Dp = D2
    while True:
        Dp += D2
        if Dp > D1:
            break
        elif Dp == D1:
            c += 1
            break
        c += 2
    print(c)

Fixed submission:
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

D1 = T1 * A1 - T1 * B1
D2 = T1 * A1 + T2 * A2 - T1 * B1 - T2 * B2

if D1 * D2 > 0:
    print(0)
elif D2 == 0:
    print("infinity")
else:
    D1 = abs(D2 - D1)
    D2 = abs(D2)
    c = (D1 // D2) * 2 - 1
    if D1 % D2 == 0:
        c -= 1
    print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
As = ""
for i in range(len(S)):
    As += chr(((ord(S[i]) - 65) + N) % 26 + 65)
print(As)

Fixed submission:
S = input()
Ds = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
print(Ds[S])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ABs = []
for i in range(N - 1):
    ABs.append(tuple(map(int, input().split())))

Cs = [0] * (N + 1)
for i in range(N - 1):
    Cs[ABs[i][0]] += 1
    Cs[ABs[i][1]] += 1
K = max(Cs)
print(K)

ABsc = [[False] * (K + 1) for _ in range(N + 1)]
Tr = [[] for _ in range(N + 1)]
for i in range(N - 1):
    p = min(ABs[i][0], ABs[i][1])
    c = max(ABs[i][0], ABs[i][1])
    Tr[p].append((c, i))
import collections

d = collections.deque()
d.append(1)


def minC(i):
    for j in range(1, K + 1):
        if not ABsc[i][j]:
            return j


Cis = [1] * N
while (len(d) > 0):
    p = d.popleft()
    for (c, i) in Tr[p]:
        d.append(c)
        col = minC(p)
        ABsc[p][col] = True
        ABsc[c][col] = True
        Cis[i] = col

for i in range(N - 1):
    print(Cis[i])

Fixed submission:
N = int(input())
ABs = []
for i in range(N - 1):
    ABs.append(tuple(map(int, input().split())))

Cs = [0] * (N + 1)
Tr = [[] for _ in range(N + 1)]
for i in range(N - 1):
    Cs[ABs[i][0]] += 1
    Cs[ABs[i][1]] += 1
    p = min(ABs[i][0], ABs[i][1])
    c = max(ABs[i][0], ABs[i][1])
    Tr[p].append((c, i))
K = max(Cs)
print(K)

import collections

d = collections.deque()
d.append(1)

Pc = [0] * (N + 1)
Nc = [1] * (N + 1)
ABsc = [0] * (N + 1)
Cis = [1] * N
while (len(d) > 0):
    p = d.popleft()
    for (c, i) in Tr[p]:
        d.append(c)
        col = Nc[p]
        if Pc[p] == col:
            col += 1
        Nc[p] = col + 1
        Pc[c] = col
        Cis[i] = col

for i in range(N - 1):
    print(Cis[i])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ls = list(map(int, input().split()))

Ls.sort()
S = 0
for i in range(N - 2):
    A = Ls[i]
    for j in range(i + 1, N - 1):
        B = Ls[j]
        for k in range(j + 1, N):
            C = Ls[k]
            if A + B <= C:
                break
            else:
                S += 1
print(S)


Fixed submission:
import bisect

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

Ls.sort()
S = 0
for i in range(N - 2):
    A = Ls[i]
    for j in range(i + 1, N - 1):
        B = Ls[j]
        k = bisect.bisect_left(Ls, A + B, j + 1)
        S += k - j - 1
print(S)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()


class Node:
    def __init__(self, num_):
        self.num = num_
        self.children = {}  # dict

    def addChild(self, ch_, num_):
        self.children[ch_] = Node(num_)


ma_max = 0
Tr = {}
for i in range(0, N):
    tr = Tr
    ma = 0
    for j in range(i, N):
        if S[j] not in tr:
            tr[S[j]] = Node(j)
            tr = tr[S[j]].children
        else:
            if tr[S[j]].num >= i:
                ma = 0
            else:
                ma += 1
            tr = tr[S[j]].children
    ma_max = max(ma_max, ma)
    if N - i < ma_max:
        break

print(ma_max)

Fixed submission:
S = input()
if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
elif S == "Rainy":
    print("Sunny")
Buggy python submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline
N = int(input())
As = [[]]
for i in range(N):
    As.append(list(map(int, input().split())))

Cs = [0] * (N + 1)
Ks = [False] * (N + 1)
d = 1
ms = 0
msMax = N * (N - 1) // 2
sw = True
tab = set()
while sw:
    c = 0
    wa = []
    for i in range(1, N + 1):
        if Ks[i]:
            continue
        if Cs[i] == N - 1:
            continue
        a = 0
        b = 0
        if i > As[i][Cs[i]]:
            a = As[i][Cs[i]]
            b = i
        else:
            a = i
            b = As[i][Cs[i]]
        if (a, b) in tab:
            ms = ms + 1
            c = c + 1
            if ms == msMax:
                sw = False
                print(d)
                break
            Cs[a] += 1
            Cs[b] += 1
            # tab.remove((a, b))
            wa.append(a)
            wa.append(b)
        else:
            tab.add((a, b))
            Ks[i] = True
    for i in wa:
        Ks[i] = False
    d += 1
    if c == 0:
        print(-1)
        break

Fixed submission:
S = input()
T = input()

c = 0
for i in range(3):
    if S[i] == T[i]:
        c += 1

print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
As = [[]]
for i in range(N):
    As.append(list(map(int, input().split())))

Cs = [0] * (N + 1)
Ks = [False] * (N + 1)
d = 1
ms = 0
msMax = N * (N - 1) // 2
sw = True
tab = set()
while sw:
    c = 0
    wa = []
    for i in range(1, N + 1):
        if Ks[i]:
            continue
        if Cs[i] == N - 1:
            continue
        a = 0
        b = 0
        if i > As[i][Cs[i]]:
            a = As[i][Cs[i]]
            b = i
        else:
            a = i
            b = As[i][Cs[i]]
        T = a * 10000 + b
        if T in tab:
            ms = ms + 1
            c = c + 1
            if ms == msMax:
                sw = False
                print(d)
                break
            Cs[a] += 1
            Cs[b] += 1
            tab.remove(T)
            wa.append(a)
            wa.append(b)
        else:
            tab.add(T)
            Ks[i] = True
    for i in wa:
        Ks[i] = False
    d += 1
    if c == 0:
        print(-1)
        break

Fixed submission:
S = input()
T = input()

c = 0
for i in range(3):
    if S[i] == T[i]:
        c += 1

print(c)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(300000)
input = sys.stdin.readline

N, Q = map(int, input().split())
children = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, input().split())
    children[a].append(b)

Ps = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    Ps[p] += x

Co = [0] * (N + 1)


def chase(now, nodes, su):
    Co[now] = Ps[now] + su
    nodes.append(now)
    for c in children[now]:
        chase(c, nodes, Co[now])


chase(1, [], 0)

Co.pop(0)
print(" ".join(map(str, Co)))

Fixed submission:
import sys

sys.setrecursionlimit(300000)
input = sys.stdin.readline

N, Q = map(int, input().split())
children = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, input().split())
    children[a].append(b)

Ps = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    Ps[p] += x

Co = [0] * (N + 1)
import collections

q = collections.deque([(1, 0)])
while (len(q) > 0):
    now, pa = q.popleft()
    Co[now] = Ps[now] + Co[pa]
    for c in children[now]:
        q.append((c, now))

Co.pop(0)
print(" ".join(map(str, Co)))

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(300000)
input = sys.stdin.readline

N, Q = map(int, input().split())
children = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, input().split())
    children[a].append(b)

alls = [[] for _ in range(N + 1)]


def chase(node):
    ret = [node]
    for c in children[node]:
        ret.extend(chase(c))
    alls[node] = ret
    return ret


chase(1)

Co = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    for j in alls[p]:
        Co[j] += x
Co.pop(0)

print(" ".join(map(str, Co)))

Fixed submission:
import sys

sys.setrecursionlimit(300000)
input = sys.stdin.readline

N, Q = map(int, input().split())
children = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, input().split())
    children[a].append(b)

Ps = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    Ps[p] += x

Co = [0] * (N + 1)
import collections

q = collections.deque([(1, 0)])
while (len(q) > 0):
    now, pa = q.popleft()
    Co[now] = Ps[now] + Co[pa]
    for c in children[now]:
        q.append((c, now))

Co.pop(0)
print(" ".join(map(str, Co)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

input = sys.stdin.readline
N = int(input())
Ss = []
for i in range(N):
    Ss.append(''.join(sorted(list(input().rstrip("\n")))))

c = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        if Ss[i] == Ss[j]:
            c += 1

print(c)

Fixed submission:
import sys

input = sys.stdin.readline
N = int(input())
Ss = {}
for i in range(N):
    s = ''.join(sorted(list(input().rstrip("\n"))))
    if s in Ss:
        Ss[s] += 1
    else:
        Ss[s] = 1

c = 0
for s in Ss.values():
    c += (s - 1) * s // 2

print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
As = list(map(int, input().split()))
As.insert(0, 0)
Ans = [0 for _ in range(N + 1)]
Ans[N] = As[N]
for i in range(N - 1, 0, -1):
    p = i * 2
    s = 0
    while p <= N:
        s += Ans[p]
        p += i
    Ans[i] = 0 if s % 2 == As[i] else 1
M = sum(Ans)
print(M)
if M > 0:
    bs = ""
    for i in range(1, N + 1):
        if Ans[i] != 0:
            bs += "%d " % i
    bs = bs.rstrip(" ")
    print(bs)

Fixed submission:
r = int(input())
print(3 * r * r)

Buggy python submission (verdict: Runtime Error):
N = int(input())
As = list(map(int, input().split()))
As.insert(0, 0)
Ans = [0 for _ in range(N + 1)]
Ans[N] = As[N]
for i in range(N - 1, 0, -1):
    p = i * 2
    s = 0
    while True:
        if p > N:
            break
        s += Ans[p]
        p += i
    Ans[i] = 0 if s % 2 == As[i] else 1
M = sum(Ans)
print(M)
if M > 0:
    bs = ""
    for i in range(1, N + 1):
        if Ans[i] != 0:
            bs += "%d " % i
    bs = bs.rstrip(" ")
    print(bs)


Fixed submission:
r = int(input())
print(3 * r * r)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(bool, map(int, input().split())))
As.insert(0, False)
Ans = [False for _ in range(N + 1)]
Ans[N] = As[N]
for i in range(N - 1, 0, -1):
    p = i * 2
    s = False
    while p <= N:
        s ^= Ans[p]
        p += i
    Ans[i] = s ^ As[i]
M = sum(Ans)
print(M)
if M > 0:
    bs = ""
    for i in range(1, N + 1):
        if Ans[i]:
            bs += "%d " % i
    bs = bs.rstrip(" ")
    print(bs)

Fixed submission:
N = int(input())
As = list(map(bool, map(int, input().split())))
As.insert(0, False)
Ans = [False for _ in range(N + 1)]
Ans[N] = As[N]
for i in range(N - 1, 0, -1):
    p = i * 2
    s = False
    while p <= N:
        s ^= Ans[p]
        p += i
    Ans[i] = s ^ As[i]
M = sum(Ans)
print(M)
if M > 0:
    c = True
    for i in range(1, N + 1):
        if Ans[i]:
            if c:
                c = False
            else:
                print(" ", end="")
            print(i, end="")
    print("")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(int, input().split()))
As.insert(0, 0)
Ans = [0 for _ in range(N + 1)]
Ans[N] = As[N]
for i in range(N - 1, 0, -1):
    p = i * 2
    s = 0
    while p <= N:
        s ^= Ans[p]
        p += i
    Ans[i] = 0 if s == As[i] else 1
M = sum(Ans)
print(M)
if M > 0:
    bs = ""
    for i in range(1, N + 1):
        if Ans[i] != 0:
            bs += "%d " % i
    bs = bs.rstrip(" ")
    print(bs)

Fixed submission:
N = int(input())
As = list(map(bool, map(int, input().split())))
As.insert(0, False)
Ans = [False for _ in range(N + 1)]
Ans[N] = As[N]
for i in range(N - 1, 0, -1):
    p = i * 2
    s = False
    while p <= N:
        s ^= Ans[p]
        p += i
    Ans[i] = s ^ As[i]
M = sum(Ans)
print(M)
if M > 0:
    c = True
    for i in range(1, N + 1):
        if Ans[i]:
            if c:
                c = False
            else:
                print(" ", end="")
            print(i, end="")
    print("")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(int, input().split()))
As.insert(0, 0)
Ans = [0 for _ in range(N + 1)]
Ans[N] = As[N]
for i in range(N - 1, 0, -1):
    k = 2
    s = 0
    while True:
        p = k * i
        if p > N:
            break
        s += Ans[p]
        k += 1
    Ans[i] = 0 if s % 2 == As[i] else 1
M = sum(Ans)
print(M)
if M > 0:
    bs = ""
    for i in range(1, N + 1):
        if Ans[i] != 0:
            bs += "%d " % i
    bs = bs.rstrip(" ")
    print(bs)

Fixed submission:
N = int(input())
As = list(map(bool, map(int, input().split())))
As.insert(0, False)
Ans = [False for _ in range(N + 1)]
Ans[N] = As[N]
for i in range(N - 1, 0, -1):
    p = i * 2
    s = False
    while p <= N:
        s ^= Ans[p]
        p += i
    Ans[i] = s ^ As[i]
M = sum(Ans)
print(M)
if M > 0:
    c = True
    for i in range(1, N + 1):
        if Ans[i]:
            if c:
                c = False
            else:
                print(" ", end="")
            print(i, end="")
    print("")
Buggy python submission (verdict: Runtime Error):
    S = set(input())
    print("Yes" if len(S) == 2 else "No")


Fixed submission:
S = set(input())
print("Yes" if len(S) == 2 else "No")

Buggy python submission (verdict: Runtime Error):

def resolve():
    S = list(raw_input())
    S.sort()
    print "Yes" if S[0] == S[1] and S[2] == S[3] else "No"

Fixed submission:
S = set(input())
print("Yes" if len(S) == 2 else "No")

Buggy python submission (verdict: Runtime Error):
import sys

S = list(raw_input())
S.sort()
print "Yes" if S[0] == S[1] and S[2] == S[3] else "No"

Fixed submission:
S = set(input())
print("Yes" if len(S) == 2 else "No")

Buggy python submission (verdict: Runtime Error):
 S = list(raw_input())
 S.sort()
 print "Yes" if S[0] == S[1] and S[2] == S[3] else "No"

Fixed submission:
S = set(input())
print("Yes" if len(S) == 2 else "No")